Class: Stormpath::Rails::AccountFromAccessToken::StormpathAccountResolution
- Inherits:
-
Object
- Object
- Stormpath::Rails::AccountFromAccessToken::StormpathAccountResolution
- Defined in:
- app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#application ⇒ Object
readonly
Returns the value of attribute application.
Instance Method Summary collapse
- #account ⇒ Object
-
#initialize(access_token) ⇒ StormpathAccountResolution
constructor
A new instance of StormpathAccountResolution.
- #jwt_data ⇒ Object
- #validate_jwt_is_access_token ⇒ Object
Constructor Details
#initialize(access_token) ⇒ StormpathAccountResolution
Returns a new instance of StormpathAccountResolution.
7 8 9 10 11 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 7 def initialize(access_token) @access_token = access_token @application = Client.application validate_jwt_is_access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
5 6 7 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 5 def access_token @access_token end |
#application ⇒ Object (readonly)
Returns the value of attribute application.
5 6 7 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 5 def application @application end |
Instance Method Details
#account ⇒ Object
13 14 15 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 13 def account Stormpath::Oauth::VerifyAccessToken.new(application).verify(access_token).account end |
#jwt_data ⇒ Object
21 22 23 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 21 def jwt_data @jwt_data ||= JWT.decode(access_token, ENV['STORMPATH_API_KEY_SECRET']) end |
#validate_jwt_is_access_token ⇒ Object
17 18 19 |
# File 'app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb', line 17 def validate_jwt_is_access_token raise AuthenticationWithRefreshTokenAttemptError if jwt_data.second['stt'] != 'access' end |