Add default kid to ID token

This commit is contained in:
theworldbright 2015-11-22 13:36:28 -08:00
parent ed1dc256a8
commit 773a5a67d9
2 changed files with 10 additions and 1 deletions

View file

@ -14,7 +14,9 @@ module Api
end
def to_jwt(options={})
to_response_object(options).to_jwt OpenidConnect::IdTokenConfig::PRIVATE_KEY
to_response_object(options).to_jwt(OpenidConnect::IdTokenConfig::PRIVATE_KEY) do |jwt|
jwt.kid = :default
end
end
def to_response_object(options={})

View file

@ -36,6 +36,13 @@ describe Api::OpenidConnect::TokenEndpoint, type: :request do
expect(decoded_token.exp).to be > Time.zone.now.utc.to_i
end
it "should return an id token with a kid" do
json = JSON.parse(response.body)
encoded_id_token = json["id_token"]
kid = JSON::JWT.decode(encoded_id_token, :skip_verification).header[:kid]
expect(kid).to eq("default")
end
it "should return a valid access token" do
json = JSON.parse(response.body)
encoded_id_token = json["id_token"]