class Stormpath::Oauth::StormpathGrantRequest
Attributes
account[RW]
api_key[RW]
application[RW]
status[RW]
Public Class Methods
new(account, application, api_key, status = :authenticated)
click to toggle source
# File lib/stormpath-sdk/oauth/stormpath_grant_request.rb 4 def initialize(account, application, api_key, status = :authenticated) 5 @account = account 6 @application = application 7 @api_key = api_key 8 @status = status.to_s.upcase 9 end
Public Instance Methods
grant_type()
click to toggle source
# File lib/stormpath-sdk/oauth/stormpath_grant_request.rb 15 def grant_type 16 'stormpath_token' 17 end
token()
click to toggle source
# File lib/stormpath-sdk/oauth/stormpath_grant_request.rb 11 def token 12 @token ||= JWT.encode(payload, api_key.secret, 'HS256') 13 end
Private Instance Methods
payload()
click to toggle source
# File lib/stormpath-sdk/oauth/stormpath_grant_request.rb 23 def payload 24 { 25 sub: account.href, 26 iat: Time.now.to_i, 27 iss: application.href, 28 status: status, 29 aud: api_key.id 30 } 31 end