Module: OpenIDConnect::JWTnizable

Included in:
RequestObject, ResponseObject::IdToken
Defined in:
lib/openid_connect/jwtnizable.rb

Instance Method Summary collapse

Instance Method Details

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

Yields:

  • (token)


3
4
5
6
7
8
9
10
# File 'lib/openid_connect/jwtnizable.rb', line 3

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