Class: OAuth2c::Grants::Assertion::JWTProfile
- Inherits:
-
Object
- Object
- OAuth2c::Grants::Assertion::JWTProfile
- Defined in:
- lib/oauth2c/grants/assertion.rb
Instance Method Summary collapse
- #assertion ⇒ Object
- #claims ⇒ Object
- #grant_type ⇒ Object
-
#initialize(alg, key, iss:, aud:, sub:, jti: SecureRandom.uuid, exp: Time.now + (5 * 60), nbf: Time.now - 1, iat: Time.now, **other_claims) ⇒ JWTProfile
constructor
A new instance of JWTProfile.
Constructor Details
#initialize(alg, key, iss:, aud:, sub:, jti: SecureRandom.uuid, exp: Time.now + (5 * 60), nbf: Time.now - 1, iat: Time.now, **other_claims) ⇒ JWTProfile
Returns a new instance of JWTProfile.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/oauth2c/grants/assertion.rb', line 22 def initialize(alg, key, iss:, aud:, sub:, jti: SecureRandom.uuid, exp: Time.now + (5 * 60), nbf: Time.now - 1, iat: Time.now, **other_claims ) @alg = alg @key = key @iss = iss @aud = aud @sub = sub @jti = jti @exp = exp @nbf = nbf @iat = iat @other_claims = other_claims end |
Instance Method Details
#assertion ⇒ Object
50 51 52 |
# File 'lib/oauth2c/grants/assertion.rb', line 50 def assertion JWT.encode(claims, @key, @alg) end |
#claims ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/oauth2c/grants/assertion.rb', line 54 def claims { iss: @iss, sub: @sub, aud: @aud, jti: @jti, exp: @exp && @exp.utc.to_i, nbf: @nbf && @nbf.utc.to_i, iat: @iat && @iat.utc.to_i, **@other_claims, } end |
#grant_type ⇒ Object
46 47 48 |
# File 'lib/oauth2c/grants/assertion.rb', line 46 def grant_type "urn:ietf:params:oauth:grant-type:jwt-bearer" end |