From f74eb2eac7d68635e746c7a9fb52244ff8e5c708 Mon Sep 17 00:00:00 2001 From: Fabian Ruff Date: Thu, 18 Feb 2016 07:50:46 +0100 Subject: [PATCH] Add optional fields to token response Signed-off-by: Fabian Ruff --- lib/portus/jwt_token.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/portus/jwt_token.rb b/lib/portus/jwt_token.rb index 895b03033..20da36248 100644 --- a/lib/portus/jwt_token.rb +++ b/lib/portus/jwt_token.rb @@ -18,7 +18,11 @@ def initialize(account, service, scopes) # response. def encoded_hash headers = { "kid" => JwtToken.kid(private_key) } - { token: JWT.encode(claim.deep_stringify_keys, private_key, "RS256", headers) }.freeze + { + token: JWT.encode(claim.deep_stringify_keys, private_key, "RS256", headers), + expires_in: expiration_time, + issued_at: Time.zone.at(issued_at).to_datetime.rfc3339 + }.freeze end # Returns a hash containing the "Claim" set as described in the