Class: CF::UAA::TokenInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/uaa/token_issuer.rb

Overview

The TokenInfo class is returned by various TokenIssuer methods. It holds access and refresh tokens as well as token meta-data such as token type and expiration time. See #info for contents.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info) ⇒ TokenInfo

Normally instantiated by CF::UAA::TokenIssuer.



32
# File 'lib/uaa/token_issuer.rb', line 32

def initialize(info) @info = info  end

Instance Attribute Details

#infoHash (readonly)

Information about the current token. The info hash MUST include access_token, token_type and scope (if granted scope differs from requested scope). It should include expires_in. It may include refresh_token, scope, and other values from the auth server.

Returns:

  • (Hash)


29
30
31
# File 'lib/uaa/token_issuer.rb', line 29

def info
  @info
end

Instance Method Details

#auth_headerString

Constructs a string for use in an authorization header from the contents of the TokenInfo.

Returns:

  • (String)

    Typically a string such as “bearer xxxx.xxxx.xxxx”.



37
38
39
# File 'lib/uaa/token_issuer.rb', line 37

def auth_header
  "#{@info[:token_type] || @info['token_type']} #{@info[:access_token] || @info['access_token']}"
end