authable v0.5.1 Authable.GrantTypes.Base
Base module for OAuth2 grant types
Summary
Functions
A common function for all Authable.GrantTypes to check if the client authorized for the given resource owner. Returns either true or false, depending on status of authorization
An abstract function for all Authable.GrantTypes. All grant type modules must implement authorize method with params
A common function to generate oauth2 tokens (access_token and refresh_token) for all Authable.GrantTypes
Functions
A common function for all Authable.GrantTypes to check if the client authorized for the given resource owner. Returns either true or false, depending on status of authorization.
Examples
Authable.GrantTypes.Base.app_authorized?(
"256a6d70-4a91-43fe-aacf-5588862ed8a2"
"52024ca6-cf1d-4a9d-bfb6-9bc5023ad56e"
)
An abstract function for all Authable.GrantTypes. All grant type modules must implement authorize method with params.
A common function to generate oauth2 tokens (access_token and refresh_token) for all Authable.GrantTypes.
To create oauth2 tokens, function requires valid ‘resource owner model’, ‘grant_type’, ‘client_id’, ‘scope’ and as optional ‘redirect_uri’. It automatically checks given scopes against configuration scopes and if any invalid scope occurs then it raises an exception with type of Authable.SuspiciousActivityError. It automatically checks the refresh_token strategy from configuration params and creates if enabled, otherwise it skips creation.
Examples
Authable.GrantTypes.Base.create_oauth2_tokens(user, "refresh_token",
"52024ca6-cf1d-4a9d-bfb6-9bc5023ad56e", "read",
"http://localhost:4000/oauth2/callbacks")