Method: OpenIDConnect::JWTnizable#as_jwt

Defined in:
lib/openid_connect/jwtnizable.rb

#as_jwt(key, algorithm = :RS256) {|token| ... } ⇒ Object

Yields:

  • (token)


7
8
9
10
11
12
# File 'lib/openid_connect/jwtnizable.rb', line 7

def as_jwt(key, algorithm = :RS256, &block)
  token = JSON::JWT.new as_json
  yield token if block_given?
  token = token.sign key, algorithm if algorithm != :none
  token
end