Class: RubstApi::Security::OAuth2PasswordBearer

Inherits:
HTTPBearer show all
Defined in:
lib/rubst_api/security.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#auto_error, #description, #scheme_name

Instance Method Summary collapse

Methods inherited from Base

#fail_auth

Constructor Details

#initialize(token_url:, scopes: {}, **options) ⇒ OAuth2PasswordBearer

Returns a new instance of OAuth2PasswordBearer.



75
76
77
78
# File 'lib/rubst_api/security.rb', line 75

def initialize(token_url:, scopes: {}, **options)
  @token_url, @scopes = token_url, scopes
  super(**options)
end

Instance Attribute Details

#scopesObject (readonly)

Returns the value of attribute scopes.



74
75
76
# File 'lib/rubst_api/security.rb', line 74

def scopes
  @scopes
end

#token_urlObject (readonly)

Returns the value of attribute token_url.



74
75
76
# File 'lib/rubst_api/security.rb', line 74

def token_url
  @token_url
end

Instance Method Details

#call(request:) ⇒ Object



79
# File 'lib/rubst_api/security.rb', line 79

def call(request:) = super.credentials

#openapi_schemeObject



80
81
82
# File 'lib/rubst_api/security.rb', line 80

def openapi_scheme
  { type: "oauth2", flows: { password: { tokenUrl: token_url, scopes: scopes } }, description: description }.compact
end