Class: Clavis::Providers::Generic
- Defined in:
- lib/clavis/providers/generic.rb
Overview
Generic provider that can be used as a template for custom providers This class requires all OAuth endpoints to be provided in the configuration
Instance Attribute Summary collapse
-
#authorize_endpoint_url ⇒ Object
readonly
Returns the value of attribute authorize_endpoint_url.
-
#token_endpoint_url ⇒ Object
readonly
Returns the value of attribute token_endpoint_url.
-
#userinfo_endpoint_url ⇒ Object
readonly
Returns the value of attribute userinfo_endpoint_url.
Attributes inherited from Base
#client_id, #client_secret, #provider_name, #redirect_uri, #scope
Instance Method Summary collapse
- #authorization_endpoint ⇒ Object
- #default_scopes ⇒ Object
-
#initialize(config = {}) ⇒ Generic
constructor
A new instance of Generic.
- #openid_provider? ⇒ Boolean
- #token_endpoint ⇒ Object
- #userinfo_endpoint ⇒ Object
Methods inherited from Base
#authorize_url, #get_user_info, #process_callback, #refresh_token, #token_exchange
Methods included from TokenExchangeHandler
#build_token_exchange_params, #handle_connection_error, #handle_error_response, #handle_faraday_error, #handle_parser_error, #handle_standard_error, #make_token_request, #parse_response, #skip_error_for_test?, #test_token_response, #validate_and_clean_code
Constructor Details
#initialize(config = {}) ⇒ Generic
Returns a new instance of Generic.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/clavis/providers/generic.rb', line 10 def initialize(config = {}) # Validation happens first validate_endpoints_config!(config) # These class vars will be derived from config, since we pass it all to super @is_openid = config[:openid_provider] || false # Support both :scope and :scopes for backward compatibility config[:scope] ||= config[:scopes] if config[:scopes] # Set provider_name explicitly for generic provider config[:provider_name] = :generic super end |
Instance Attribute Details
#authorize_endpoint_url ⇒ Object (readonly)
Returns the value of attribute authorize_endpoint_url.
8 9 10 |
# File 'lib/clavis/providers/generic.rb', line 8 def end |
#token_endpoint_url ⇒ Object (readonly)
Returns the value of attribute token_endpoint_url.
8 9 10 |
# File 'lib/clavis/providers/generic.rb', line 8 def token_endpoint_url @token_endpoint_url end |
#userinfo_endpoint_url ⇒ Object (readonly)
Returns the value of attribute userinfo_endpoint_url.
8 9 10 |
# File 'lib/clavis/providers/generic.rb', line 8 def userinfo_endpoint_url @userinfo_endpoint_url end |
Instance Method Details
#authorization_endpoint ⇒ Object
26 27 28 |
# File 'lib/clavis/providers/generic.rb', line 26 def end |
#default_scopes ⇒ Object
38 39 40 |
# File 'lib/clavis/providers/generic.rb', line 38 def default_scopes @scope || "" end |
#openid_provider? ⇒ Boolean
42 43 44 |
# File 'lib/clavis/providers/generic.rb', line 42 def openid_provider? @is_openid end |
#token_endpoint ⇒ Object
30 31 32 |
# File 'lib/clavis/providers/generic.rb', line 30 def token_endpoint @token_endpoint_url end |
#userinfo_endpoint ⇒ Object
34 35 36 |
# File 'lib/clavis/providers/generic.rb', line 34 def userinfo_endpoint @userinfo_endpoint_url end |