Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(agama): create custom parameter for agama flows #3020

Merged
merged 2 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agama/engine/profiles/default/config-agama-test.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#The URL of your Jans installation
server=https://jgomer2001-guiding-herring.gluu.info

clientId=1800.5e01b3bb-1f68-4847-b9ba-d5c999a05e33
clientId=BADA-BADA

custParamName=customParam1
custParamName=agama_flow
6 changes: 3 additions & 3 deletions docs/admin/developer/agama/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ Finally the flow assets must be uploaded. You can SFTP/SCP or use other means to

This section assumes your [client application](#client-application) is ready, or at least you have made the configurations required so that you can trigger an (OpendId Connect) authentication request.

This usually boils down to create and launch a URL looking like `https://<your-host>/jans-auth/restv1/authorize?acr_values=agama&customParam1=flow-qname&scope=...&response_type=...&redirect_uri=https...&client_id=...&state=...`. You may like to check the [spec](https://openid.net/specs/openid-connect-core-1_0.html) for more details, however, keep in mind that:
This usually boils down to create and launch a URL looking like `https://<your-host>/jans-auth/restv1/authorize?acr_values=agama&agama_flow=flow-qname&scope=...&response_type=...&redirect_uri=https...&client_id=...&state=...`. You may like to check the [spec](https://openid.net/specs/openid-connect-core-1_0.html) for more details, however, keep in mind that:

- To trigger an Agama flow, the `acr_values` parameter must be equal to `agama`

- The qualified name (identifier) of the flow to trigger is passed using the parameter referenced in property `cust_param_name` of the Agama bridge script. `customParam1` will work in most cases since this is the default value employed by the Jans installer. For the current example `customParam1=test` should be fine
- The qualified name (identifier) of the flow to trigger is passed using the parameter referenced in property `cust_param_name` of the Agama bridge script. `agama_flow` will work in most cases since this is the default value employed by the Jans installer. For the current example `agama_flow=test` should be fine

!!! Note
To use a different parameter name ensure to register the given parameter in the [server configuration](../../config-guide/jans-cli/im/im-jans-authorization-server.md) (property `authorizationRequestCustomAllowedParameters`) and update the bridge accordingly

- If the flow to call receives input parameters, their values can be passed in the custom parameter as well. Use a hyphen to separate the flow name and the parameters expressed in JSON object format. For example, if the flow had inputs `height` and `color`, you can use `test-{"height": 190, "color": "blue"}` for the value of `customParam1`. Ensure to apply proper URL-encoding beforehand. In this case, the actual value would be `test-%7B%22height%22%3A+190%2C+%22color%22%3A+%22blue%22%7D`. If certain inputs are not provided, `null` values will be assigned for them
- If the flow to call receives input parameters, their values can be passed in the custom parameter as well. Use a hyphen to separate the flow name and the parameters expressed in JSON object format. For example, if the flow had inputs `height` and `color`, you can use `test-{"height": 190, "color": "blue"}` for the value of `agama_flow`. Ensure to apply proper URL-encoding beforehand. In this case, the actual value would be `test-%7B%22height%22%3A+190%2C+%22color%22%3A+%22blue%22%7D`. If certain inputs are not provided, `null` values will be assigned for them

### Testing

Expand Down
4 changes: 4 additions & 0 deletions jans-auth-server/server/conf/jans-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@
{
"paramName": "customParam5",
"returnInResponse": true
},
{
"paramName": "agama_flow",
"returnInResponse": false
}
],
"legacyDynamicRegistrationScopeParam": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@
{
"paramName": "customParam5",
"returnInResponse": true
},
{
"paramName": "agama_flow",
"returnInResponse": false
}
],
"legacyDynamicRegistrationScopeParam": false,
Expand Down
2 changes: 1 addition & 1 deletion jans-linux-setup/jans_setup/templates/scripts.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ objectClass: top
description: Agama Script
displayName: agama
inum: BADA-BADA
jansConfProperty: {"value1":"cust_param_name","value2":"customParam1","hide":false,"description":""}
jansConfProperty: {"value1":"cust_param_name","value2":"agama_flow","hide":false,"description":""}
jansEnabled: false
jansLevel: 10
jansModuleProperty: {"value1":"usage_type","value2":"interactive","description":""}
Expand Down