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.



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

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)


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

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”.



39
40
41
# File 'lib/uaa/token_issuer.rb', line 39

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