mirror of
https://github.com/czhu12/canine.git
synced 2025-12-20 10:19:50 -06:00
37 lines
1.3 KiB
Ruby
37 lines
1.3 KiB
Ruby
# == Schema Information
|
|
#
|
|
# Table name: oidc_configurations
|
|
#
|
|
# id :bigint not null, primary key
|
|
# issuer :string not null
|
|
# client_id :string not null
|
|
# client_secret :string not null
|
|
# authorization_endpoint :string
|
|
# token_endpoint :string
|
|
# userinfo_endpoint :string
|
|
# jwks_uri :string
|
|
# scopes :string default("openid email profile")
|
|
# uid_claim :string default("sub"), not null
|
|
# email_claim :string default("email")
|
|
# name_claim :string default("name")
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
class OIDCConfiguration < ApplicationRecord
|
|
has_one :sso_provider, as: :configuration, dependent: :destroy
|
|
has_one :account, through: :sso_provider
|
|
|
|
validates :issuer, presence: true
|
|
validates :client_id, presence: true
|
|
validates :client_secret, presence: true
|
|
validates :uid_claim, presence: true
|
|
|
|
def discovery_url
|
|
URI.join(issuer, ".well-known/openid-configuration").to_s
|
|
end
|
|
|
|
def uses_discovery?
|
|
authorization_endpoint.blank? && token_endpoint.blank?
|
|
end
|
|
end
|