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.1"
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.
29 30 31 32 33 |
# File 'lib/layer/identity_token.rb', line 29 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
16 17 18 |
# File 'lib/layer/identity_token.rb', line 16 def layer_key_id @layer_key_id || ENV["LAYER_KEY_ID"] end |
.layer_private_key ⇒ Object
20 21 22 |
# File 'lib/layer/identity_token.rb', line 20 def layer_private_key @layer_private_key || ENV["LAYER_PRIVATE_KEY"] end |
.layer_provider_id ⇒ Object
12 13 14 |
# File 'lib/layer/identity_token.rb', line 12 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.
25 26 27 |
# File 'lib/layer/identity_token.rb', line 25 def expires_at @expires_at end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
25 26 27 |
# File 'lib/layer/identity_token.rb', line 25 def nonce @nonce end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
25 26 27 |
# File 'lib/layer/identity_token.rb', line 25 def user_id @user_id end |
Instance Method Details
#as_json(options = {}) ⇒ Object
39 40 41 |
# File 'lib/layer/identity_token.rb', line 39 def as_json( = {}) encode end |
#encode ⇒ Object Also known as: to_s
35 36 37 |
# File 'lib/layer/identity_token.rb', line 35 def encode JWT.encode(claim, private_key, "RS256", headers) end |