Add default kid to ID token
This commit is contained in:
parent
ed1dc256a8
commit
773a5a67d9
2 changed files with 10 additions and 1 deletions
|
|
@ -14,7 +14,9 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_jwt(options={})
|
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
|
end
|
||||||
|
|
||||||
def to_response_object(options={})
|
def to_response_object(options={})
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,13 @@ describe Api::OpenidConnect::TokenEndpoint, type: :request do
|
||||||
expect(decoded_token.exp).to be > Time.zone.now.utc.to_i
|
expect(decoded_token.exp).to be > Time.zone.now.utc.to_i
|
||||||
end
|
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
|
it "should return a valid access token" do
|
||||||
json = JSON.parse(response.body)
|
json = JSON.parse(response.body)
|
||||||
encoded_id_token = json["id_token"]
|
encoded_id_token = json["id_token"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue