Class: Layer::IdentityToken
- Inherits:
-
Object
- Object
- Layer::IdentityToken
- Defined in:
- lib/layer/identity_token.rb,
lib/layer/identity_token/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #encode ⇒ Object (also: #to_s)
-
#initialize(user_id, nonce, expires_at = (Time.now+(86400*14))) ⇒ IdentityToken
constructor
A new instance of IdentityToken.
Constructor Details
#initialize(user_id, nonce, expires_at = (Time.now+(86400*14))) ⇒ IdentityToken
Returns a new instance of IdentityToken.
27 28 29 30 31 |
# File 'lib/layer/identity_token.rb', line 27 def initialize(user_id, nonce, expires_at = (Time.now+(86400*14))) @user_id = user_id @nonce = nonce @expires_at = expires_at end |
Class Attribute Details
.layer_key_id ⇒ Object
14 15 16 |
# File 'lib/layer/identity_token.rb', line 14 def layer_key_id @layer_key_id || ENV["LAYER_KEY_ID"] end |
.layer_private_key ⇒ Object
18 19 20 |
# File 'lib/layer/identity_token.rb', line 18 def layer_private_key @layer_private_key || ENV["LAYER_PRIVATE_KEY"] end |
.layer_provider_id ⇒ Object
10 11 12 |
# File 'lib/layer/identity_token.rb', line 10 def layer_provider_id @layer_provider_id || ENV["LAYER_PROVIDER_ID"] end |
Instance Attribute Details
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
23 24 25 |
# File 'lib/layer/identity_token.rb', line 23 def expires_at @expires_at end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
23 24 25 |
# File 'lib/layer/identity_token.rb', line 23 def nonce @nonce end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
23 24 25 |
# File 'lib/layer/identity_token.rb', line 23 def user_id @user_id end |
Instance Method Details
#as_json(options = {}) ⇒ Object
37 38 39 |
# File 'lib/layer/identity_token.rb', line 37 def as_json( = {}) encode end |
#encode ⇒ Object Also known as: to_s
33 34 35 |
# File 'lib/layer/identity_token.rb', line 33 def encode JWT.encode(claim, private_key, "RS256", headers) end |