Hor Oidc Sign Inのロゴ

Hor Oidc Sign In

組織
openreachtech
hor-oidc-sign-in

Sign an actor in through an external OpenID Connect identity provider on a renchan backend: the authorization code flow with PKCE, where state, nonce and the code verifier live, how the ID token is verified, and how the provider's subject links to an actor. Use when adding a 'sign in with' provider. Boundary: tokens, sessions and the refresh cookie follow the cookie authentication convention; a proxy that signs users in before the app, such as IAP, is not this flow.

概要

公開者openreachtech
リポジトリhora-skills-ort-renchan
スキル名hor-oidc-sign-in
スター
32
フォーク
0
同梱ファイル
4
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    openreachtechがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Hor Oidc Sign In」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-oidc-sign-in
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openreachtech/hora-skills-ort-renchan.git /tmp/hora-skills-ort-renchan
mkdir -p .claude/skills
cp -r /tmp/hora-skills-ort-renchan/kit/skills/hor-oidc-sign-in .claude/skills/hor-oidc-sign-in
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでHor Oidc Sign Inを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にHor Oidc Sign Inを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Hor Oidc Sign Inは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

OIDC Sign-in (Backend)

Use this skill when an actor signs in at an external OpenID Connect identity provider (IdP) instead of with a password held by the app. The app is a confidential client: it holds the client secret, starts the flow, receives the authorization code, exchanges it, verifies the ID token, and links the provider's account to one of its own actors.

This skill ends at an actor entity. Opening the session from there is /hor-cookie-authentication, unchanged: SessionClerk.saveSession, the refresh-token cookie, and the access token in the response body. After sign-in, every request still authenticates by the access-token header, renewAccessToken still renews, and signOut still revokes. Nothing in this skill touches those. A proxy that signs the user in before the request reaches the app (IAP) has no code exchange and no session: see /hor-restfulapi-architecture, its behind-iap reference.

Snippets use <Actor> for the role being signed in, as /hor-cookie-authentication does.

The flow

Two public mutations bracket a trip to the IdP. The browser never sees the client secret, the code verifier or the nonce.

frontend            backend                                   identity provider
   | startOidcSignIn     |
   |-------------------->| create state, nonce, code verifier
   |                     | save the authorization row, set the state cookie
   |<--------------------| authorizationUrl
   | navigate ---------------------------------------------->| user signs in
   |<---------------------------------------- redirect to redirect_uri?code&state
   | signInWithOidc      |
   |  { code, state }    | state == cookie == row, row unused and unexpired
   |-------------------->| exchange code + code verifier + client secret ---->|
   |                     |<--------------------------------------- ID token --|
   |                     | verify the ID token, find or link the actor
   |                     | saveSession, refresh cookie, clear the state cookie
   |<--------------------| accessToken

A public mutation pair follows the precedent /hor-graphql-server-engine sets with its public operations. The alternative is a REST GET callback on the backend that answers with a redirect. Choose it only when no frontend page can receive the IdP's redirect. The renderer then answers with a redirect flusher and sets the cookies through the response headers (/hor-restfulapi-architecture), and the rules below hold unchanged.

Rules that keep the flow safe

  • PKCE with S256 on every authorization, even though the app holds a secret. The code_challenge is the SHA-256 digest of the verifier, base64url-encoded without padding. The verifier is 32 random bytes from crypto.randomBytes, base64url-encoded.
  • state ties the callback to the browser that started it. The backend writes it to a short-lived HttpOnly cookie and to the authorization row. signInWithOidc accepts the call only when the state argument, the cookie and a row all agree. Without the cookie, an attacker could hand a victim a callback link that signs the victim in as the attacker.
  • The authorization row is single use and expires in about ten minutes. Spend it with one update guarded on usedAt: null and on expiredAt still ahead, as the refresh-token rotation guards its own, so a replayed or late callback updates nothing. Missing, used and expired rows all raise one error, so the response does not say which.
  • nonce travels inside the ID token. Compare the token's nonce claim to the one stored in the row.
  • Verify the ID token before reading any claim from it (id-token-verification). The code exchange happens over TLS straight from the IdP, but the signature check is still required, because the claims are what the app is about to trust.
  • redirect_uri is a configured value, never taken from the request, and it matches the IdP's registration exactly. The same string goes into the authorization URL and into the token request.
  • Link an actor by (issuer, subject), never by email alone. sub is stable and an email address can change hands. A first sign-in may attach to a pre-registered actor by email only when the token carries email_verified: true, and only once: the identity row it writes is what every later sign-in finds.
  • Keep the IdP's tokens out of storage unless the app calls the IdP's APIs on the actor's behalf. Signing in needs the ID token once, during the callback.
  • The client secret is read through the Share (share.env), like every other env value (environment). Log neither the code, the verifier nor any token.

Core

TopicDescriptionReference
Environment & configThe OIDC_* env vars, the discovery document, the state-cookie constant and the engine's public operationsenvironment
Authorization & identity storageThe two tables and their models: the single-use authorization row and the (issuer, subject) identity linkstorage
ID token verificationOidcIdTokenVerifier: signature by kid, iss, aud, exp, nonce, and why the Share keeps itid-token-verification
ResolversstartOidcSignIn and signInWithOidc, wired to the session clerk and the cookie clerkresolvers

The token-endpoint call and the discovery and key fetches are an external API client (/hor-external-api-client). The IdP stand-in for local runs belongs to /hor-build-e2e-test-environment.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Hor Oidc Sign In」では何ができますか?

Sign an actor in through an external OpenID Connect identity provider on a renchan backend: the authorization code flow with PKCE, where state, nonce and the code verifier live, how the ID token is verified, and how the provider's subject links to an actor. Use when adding a 'sign in with' provider. Boundary: tokens, sessions and the refresh cookie follow the cookie authentication convention; a proxy that signs users in before the app, such as IAP, is not this flow.

TypingMindでHor Oidc Sign Inを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Hor Oidc Sign Inはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにHor Oidc Sign Inをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-oidc-sign-inを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Hor Oidc Sign Inを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Hor Oidc Sign Inで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもHor Oidc Sign Inを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Hor Oidc Sign In」は無料ですか?

はい。openreachtechがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇