Class: SsoOauthToken

Inherits:
Object
  • Object
show all
Defined in:
lib/app/models/sso_oauth_token.rb

Overview

OAuth 2.0 Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



7
8
9
# File 'lib/app/models/sso_oauth_token.rb', line 7

def access_token
  @access_token
end

#expiryObject

Returns the value of attribute expiry.



7
8
9
# File 'lib/app/models/sso_oauth_token.rb', line 7

def expiry
  @expiry
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



7
8
9
# File 'lib/app/models/sso_oauth_token.rb', line 7

def refresh_token
  @refresh_token
end

#token_typeObject

Returns the value of attribute token_type.



7
8
9
# File 'lib/app/models/sso_oauth_token.rb', line 7

def token_type
  @token_type
end

Instance Method Details

#authorizationObject

This method is abstract.

The authorization string for this token type

Returns String.

Returns:

  • String



11
12
13
# File 'lib/app/models/sso_oauth_token.rb', line 11

def authorization
  [type, access_token].compact.join(' ')
end

#typeObject



15
16
17
# File 'lib/app/models/sso_oauth_token.rb', line 15

def type
  @token_type.presence || 'Bearer'
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/app/models/sso_oauth_token.rb', line 19

def valid?
  @access_token.present? && (@expiry.nil? || Time.now.utc < @expiry)
end