Class: ADAL::UserIdentifier
- Inherits:
-
Object
- Object
- ADAL::UserIdentifier
- Includes:
- Type
- Defined in:
- lib/adal/user_identifier.rb
Overview
Identifier for users in the cache.
Ideally, the application will first use a different OAuth flow, such as the Authorization Code flow, to acquire an ADAL::SuccessResponse. Then, it can create ADAL::UserIdentifier to query the cache which will refresh tokens as necessary.
Defined Under Namespace
Modules: Type
Constant Summary
Constants included from Type
Type::DISPLAYABLE_ID, Type::UNIQUE_ID
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Overrides comparison operator for cache lookups.
-
#initialize(id, type) ⇒ Object
constructor
Creates a UserIdentifier with a specific type.
-
#request_params ⇒ Object
These parameters should only be used for cache lookup.
Constructor Details
#initialize(id, type) ⇒ Object
Creates a UserIdentifier with a specific type. Used for cache lookups. Matches .NET ADAL implementation.
49 50 51 52 53 54 55 |
# File 'lib/adal/user_identifier.rb', line 49 def initialize(id, type) unless [UNIQUE_ID, DISPLAYABLE_ID].include? type fail ArgumentError, 'type must be an ADAL::UserIdentifier::Type.' end @id = id @type = type end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
31 32 33 |
# File 'lib/adal/user_identifier.rb', line 31 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
32 33 34 |
# File 'lib/adal/user_identifier.rb', line 32 def type @type end |
Instance Method Details
#==(other) ⇒ Object
Overrides comparison operator for cache lookups
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/adal/user_identifier.rb', line 71 def ==(other) case other when UserIdentifier self.equal? other when UserInformation (type == UNIQUE_ID && id == other.unique_id) || (type == DISPLAYABLE_ID && id == other.displayable_id) when String @id == other end end |
#request_params ⇒ Object
These parameters should only be used for cache lookup. This is enforced by ADAL::TokenRequest.
62 63 64 |
# File 'lib/adal/user_identifier.rb', line 62 def request_params { user_info: self } end |