OpenID Provider (OP) / IdPごとの設定例 実際のコード例はこちら.
OpenID Connect 'response_type' and flows OpenID Connect 仕様 response_type の組み合わせが決まっている。その使い分けについて。
providerメソッドの第1引数に, :openid_connect を与えます。第2引数のhash で設定を与えます;
:name
/auth/<name>.
:issuer
issuer フィールド値. IdPを識別する URI.
:discovery
true にします。<issuer>/.well-known/openid-configuration から設定を自動取得します。
もし false にする場合は, client_options に次を与えてください.
:authorization_endpoint
:token_endpoint
:userinfo_endpoint
さらに, id_token の検証のため, 認証サーバの公開鍵, または公開鍵のハッシュを次のオプションに設定;
:client_x509_signing_key
:scope
'openid' を含めてください (MUST).
サポートされる値は, <issuer>/.well-known/openid-configuration の scopes_supported 値.
:response_type
:code (the Authorization Code Flow), ['id_token', 'token'] (the Implicit Flow).
The Hybrid Flow -- ['code', 'token'], ['code', 'id_token'] or ['code', 'id_token', 'token'] -- はサポートしません。
client_options は次のように設定します; Hash型
:scheme, :host, :port
authorization_endpoint のホスト. 通常は <issuer> のホストと同じため、<issuer> から自動生成される。異なる場合は明示的に指定が必要。
:identifier
:secret
:redirect_uri