Repository navigation
Add AI agent detection conditional authentication templates #8366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shashimalcse
merged 2 commits into
wso2:master
from
shashimalcse:feature/ai-agent-templates
Oct 20, 2026
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...cation.mgt.server.feature/resources/identity/authenticationTemplates/aiAgentBlocking.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { | ||
| "category": "AIAgents", | ||
| "name": "AI-Agent-Blocking", | ||
| "title": "AI Agent Blocking Template", | ||
| "summary": "Denies sign-in to AI agents that identify themselves with Web Bot Auth.", | ||
| "preRequisites": [ | ||
| "Modify the authentication option(s) from defaults as required.", | ||
| "AI agents are identified by their Web Bot Auth headers (Signature, Signature-Input and Signature-Agent). Make sure your load balancers and proxies forward them to the server.", | ||
| "To identify AI agents that do not use Web Bot Auth, extend detectAgent(). See the documentation for examples." | ||
| ], | ||
| "parametersDescription": { | ||
| "errorMessage": "Message shown to blocked clients" | ||
| }, | ||
| "defaultStepsDescription": { | ||
| "Step 1": "Basic (Password) authenticator" | ||
| }, | ||
| "authenticationSteps": 1, | ||
| "defaultAuthenticators": { | ||
| "1": { | ||
| "local": [ | ||
| "BasicAuthenticator" | ||
| ], | ||
| "federated": [] | ||
| } | ||
| }, | ||
| "helpLink": "", | ||
| "code": [ | ||
| "// This script denies sign-in when the request comes from an AI agent.", | ||
| "//", | ||
| "// AI agents that use Web Bot Auth sign every request with HTTP Message Signatures and declare themselves", | ||
| "// in the Signature-Agent header. To identify other AI agents, extend detectAgent().", | ||
| "// See the documentation for more identification methods.", | ||
| "", | ||
| "// Message shown to blocked clients.", | ||
| "var errorMessage = 'AI agents are not allowed to sign in to this application.';", | ||
| "", | ||
| "var onLoginRequest = function (context) {", | ||
| " if (detectAgent(context)) {", | ||
| " Log.info('AI agent blocked for application: ' + context.serviceProviderName);", | ||
| " var responseMode = context.request.params.response_mode;", | ||
| " if (responseMode && responseMode[0] === 'direct') {", | ||
| " fail({'errorCode': 'access_denied', 'errorMessage': errorMessage});", | ||
| " } else {", | ||
| " sendError(null, {'status': 'ACCESS_DENIED', 'statusMsg': errorMessage});", | ||
| " }", | ||
| " return;", | ||
| " }", | ||
| " executeStep(1);", | ||
| "};", | ||
| "", | ||
| "// Returns true when the request comes from an AI agent that identifies itself with Web Bot Auth.", | ||
| "var detectAgent = function (context) {", | ||
| " // Header names are lower-case.", | ||
| " var headers = context.request.headers;", | ||
| " // Signed agents send a Signature-Agent header and a Signature-Input header with tag=\"web-bot-auth\".", | ||
| " // The declaration is enough to deny or step up an agent. Verify the signature (for example at your edge)", | ||
| " // before trusting a specific agent.", | ||
| " var signatureInput = String(headers['signature-input'] || '');", | ||
| " return !!headers['signature-agent'] || signatureInput.indexOf('web-bot-auth') >= 0;", | ||
| "};" | ||
| ], | ||
| "runtime": "any" | ||
| } | ||
69 changes: 69 additions & 0 deletions
69
....mgt.server.feature/resources/identity/authenticationTemplates/aiAgentHumanInTheLoop.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| { | ||
| "category": "AIAgents", | ||
| "name": "AI-Agent-Human-in-the-Loop", | ||
| "title": "AI Agent Human-in-the-Loop Template", | ||
| "summary": "Requires a human-only verification step, such as a passkey, when an AI agent that identifies itself with Web Bot Auth signs in.", | ||
| "preRequisites": [ | ||
| "Modify the 1st and 2nd factor authentication option(s) from defaults as required.", | ||
| "AI agents are identified by their Web Bot Auth headers (Signature, Signature-Input and Signature-Agent). Make sure your load balancers and proxies forward them to the server.", | ||
| "To identify AI agents that do not use Web Bot Auth, extend detectAgent(). See the documentation for examples.", | ||
| "The 2nd step must be one that only a human can complete, such as a passkey or a push notification. Do not enable progressive enrollment for it in this flow, so an agent cannot enroll its own device." | ||
| ], | ||
| "parametersDescription": {}, | ||
| "defaultStepsDescription": { | ||
| "Step 1": "Basic (Password) authenticator", | ||
| "Step 2": "Passkey authenticator (human-only verification)" | ||
| }, | ||
| "authenticationSteps": 2, | ||
| "defaultAuthenticators": { | ||
| "1": { | ||
| "local": [ | ||
| "BasicAuthenticator" | ||
| ], | ||
| "federated": [] | ||
| }, | ||
| "2": { | ||
| "local": [ | ||
| "FIDOAuthenticator" | ||
| ], | ||
| "federated": [] | ||
| } | ||
| }, | ||
| "helpLink": "", | ||
| "code": [ | ||
| "// This script requires a human-only verification step (passkey by default) when the request comes from an AI agent.", | ||
| "//", | ||
| "// AI agents that use Web Bot Auth sign every request with HTTP Message Signatures and declare themselves", | ||
| "// in the Signature-Agent header. To identify other AI agents, extend detectAgent().", | ||
| "// See the documentation for more identification methods.", | ||
| "", | ||
| "// Detection result for this login flow. Top-level variables are kept across the steps of a flow.", | ||
| "var agentDetected = false;", | ||
| "", | ||
| "var onLoginRequest = function (context) {", | ||
| " // Request headers of the sign-in request are only available here, so detect before running the steps.", | ||
| " agentDetected = detectAgent(context);", | ||
| " executeStep(1, {", | ||
| " onSuccess: function (context) {", | ||
| " if (agentDetected) {", | ||
| " Log.info('AI agent detected for application: ' + context.serviceProviderName +", | ||
| " '. Requiring human verification.');", | ||
| " executeStep(2);", | ||
| " }", | ||
| " }", | ||
| " });", | ||
| "};", | ||
| "", | ||
| "// Returns true when the request comes from an AI agent that identifies itself with Web Bot Auth.", | ||
| "var detectAgent = function (context) {", | ||
| " // Header names are lower-case.", | ||
| " var headers = context.request.headers;", | ||
| " // Signed agents send a Signature-Agent header and a Signature-Input header with tag=\"web-bot-auth\".", | ||
| " // The declaration is enough to deny or step up an agent. Verify the signature (for example at your edge)", | ||
| " // before trusting a specific agent.", | ||
| " var signatureInput = String(headers['signature-input'] || '');", | ||
| " return !!headers['signature-agent'] || signatureInput.indexOf('web-bot-auth') >= 0;", | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| "};" | ||
| ], | ||
| "runtime": "any" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.