Class: MyApp::Providers::ExampleOAuth
- Inherits:
-
Clavis::Providers::Base
- Object
- Clavis::Providers::Base
- MyApp::Providers::ExampleOAuth
- Defined in:
- lib/clavis/providers/custom_provider_example.rb
Overview
Example of a custom OAuth provider implementation This example is for a fictional OAuth provider called "ExampleOAuth"
Instance Attribute Summary
Attributes inherited from Clavis::Providers::Base
#authorize_endpoint_url, #client_id, #client_secret, #redirect_uri, #scope, #token_endpoint_url, #userinfo_endpoint_url
Instance Method Summary collapse
-
#authorization_endpoint ⇒ Object
Required: Implement the authorization endpoint.
-
#default_scopes ⇒ Object
Optional: Override the default scopes.
-
#openid_provider? ⇒ Boolean
Optional: Specify if this is an OpenID Connect provider.
-
#provider_name ⇒ Object
Override the provider_name method if you want a different name than the class name.
-
#token_endpoint ⇒ Object
Required: Implement the token endpoint.
-
#userinfo_endpoint ⇒ Object
Required: Implement the userinfo endpoint.
Methods inherited from Clavis::Providers::Base
#authorize_url, #get_user_info, #initialize, #process_callback, #refresh_token, #token_exchange
Methods included from Clavis::Providers::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
This class inherits a constructor from Clavis::Providers::Base
Instance Method Details
#authorization_endpoint ⇒ Object
Required: Implement the authorization endpoint
14 15 16 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 14 def "https://auth.example.com/oauth2/authorize" end |
#default_scopes ⇒ Object
Optional: Override the default scopes
29 30 31 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 29 def default_scopes "profile email" end |
#openid_provider? ⇒ Boolean
Optional: Specify if this is an OpenID Connect provider
34 35 36 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 34 def openid_provider? false end |
#provider_name ⇒ Object
Override the provider_name method if you want a different name than the class name
9 10 11 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 9 def provider_name :example_oauth end |
#token_endpoint ⇒ Object
Required: Implement the token endpoint
19 20 21 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 19 def token_endpoint "https://auth.example.com/oauth2/token" end |
#userinfo_endpoint ⇒ Object
Required: Implement the userinfo endpoint
24 25 26 |
# File 'lib/clavis/providers/custom_provider_example.rb', line 24 def userinfo_endpoint "https://api.example.com/userinfo" end |