Sha256: abc56ebb787f0d1ef76700be9e00ad9377a904a6b910fecb41a6bc2aa0981e7b
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module Masks module Rails module OpenID class IdToken < ApplicationRecord self.table_name = "openid_id_tokens" belongs_to :actor, class_name: Masks.configuration.models[:actor] belongs_to :openid_client, class_name: Masks.configuration.models[:openid_client] def to_response_object(with = {}) subject = if openid_client.pairwise_subject? openid_client.subject_for(actor) else actor.actor_id end claims = { sub: subject, iss: openid_client.issuer, aud: openid_client.audience, exp: expires_at.to_i, iat: created_at.to_i, nonce: } id_token = OpenIDConnect::ResponseObject::IdToken.new(claims) id_token.code = with[:code] if with[:code] id_token.access_token = with[:access_token] if with[:access_token] id_token end def to_jwt(with = {}) to_response_object(with).to_jwt(openid_client.private_key) do |jwt| jwt.kid = openid_client.kid end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
masks-0.4.0 | app/models/masks/rails/openid/id_token.rb |