Method: CF::UAA::TokenCoder#encode
- Defined in:
- lib/uaa/token_coder.rb
#encode(token_body = {}, algorithm = nil) ⇒ String
Encode a JWT token. Takes a hash of values to use as the token body. Returns a signed token in JWT format (header, body, signature).
166 167 168 169 170 |
# File 'lib/uaa/token_coder.rb', line 166 def encode(token_body = {}, algorithm = nil) token_body[:aud] = @options[:audience_ids] if @options[:audience_ids] && !token_body[:aud] && !token_body['aud'] token_body[:exp] = Time.now.to_i + 7 * 24 * 60 * 60 unless token_body[:exp] || token_body['exp'] self.class.encode(token_body, algorithm ? @options.merge(:algorithm => algorithm) : @options) end |