class ADAL::UserIdentifier

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.

Attributes

id[R]
type[R]

Public Class Methods

new(id, type) click to toggle source

Creates a UserIdentifier with a specific type. Used for cache lookups. Matches .NET ADAL implementation.

@param String id @param UserIdentifier::Type @return ADAL::UserIdentifier

# 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

Public Instance Methods

==(other) click to toggle source

Overrides comparison operator for cache lookups

@param UserIdentifier other @return Boolean

# 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() click to toggle source

These parameters should only be used for cache lookup. This is enforced by ADAL::TokenRequest.

@return Hash

# File lib/adal/user_identifier.rb, line 62
def request_params
  { user_info: self }
end