Skip to content

Commit

Permalink
feat(agama): add a "default agama flow" to bridge (#4309)
Browse files Browse the repository at this point in the history
* docs: add details about bridge parameter default_flow_name #4293

* feat: add default_flow_name for agama script #4293
  • Loading branch information
jgomer2001 committed Mar 26, 2023
1 parent 65669dc commit 3b2248f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/admin/developer/agama/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ The quick start guide is a must, followed by [A closer look to Hello world flow]

## Miscellaneous

### How to launch a flow?

A flow is launched by issuing an authentication request in a browser as explained [here](./quick-start.md#craft-an-authentication-request).

### Does flow execution timeout?

Yes. The maximum amount of time an end-user can take to fully complete a flow is driven by the configuration of the authentication server and can be constrained even more in the flow itself. Read about timeouts [here](./flows-lifecycle.md#timeouts).
Expand Down
2 changes: 2 additions & 0 deletions docs/admin/developer/agama/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ This usually boils down to create and launch a URL looking like `https://<your-h

- 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

- If for some reason you are not able to set the given custom parameter in the authorization request, you can set its value in the configuration property `default_flow_name` of the bridge script. Note this will launch the same fixed flow at all times

### Testing

Launch the authentication request in a web browser - preferably in a private window, a.k.a. incognito. You will be taken to a plain HTML page with a salutation and a "continue" button. After submission, a quick "Redirecting you" page will be shown and you will be taken probably to an error page showing "Unable to determine identity of user". That's expected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ def init(self, customScript, configurationAttributes):
if self.cust_param_name == None:
print "Agama. Custom parameter name not referenced via property '%s'" % prop
return False

prop = "default_flow_name"
self.default_flow_name = self.configProperty(configurationAttributes, prop)

print "Agama. Request param '%s' will be used to pass flow inputs" % self.cust_param_name
print "Agama. Request param '%s' will be used to pass flow name and inputs" % self.cust_param_name
print "Agama. When '%s' is missing, the flow to launch will be '%s'" % (self.cust_param_name, self.default_flow_name)

print "Agama. Initialized successfully"
return True

Expand Down Expand Up @@ -109,9 +114,15 @@ def prepareForStep(self, configurationAttributes, requestParameters, step):
return False

param = session.getSessionAttributes().get(self.cust_param_name)
if param == None:
if StringHelper.isEmpty(param):
print "Agama. Request param '%s' is missing or has no value" % self.cust_param_name
return False

param = self.default_flow_name
if StringHelper.isEmpty(param):
print "Agama. Default flow name is not set either..."

print "Agama. Unable to determine the Agama flow to launch. Check the docs"
return False

(qn, ins) = self.extractParams(param)
if qn == None:
Expand Down
1 change: 1 addition & 0 deletions jans-linux-setup/jans_setup/templates/scripts.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ description: Agama Script
displayName: agama
inum: BADA-BADA
jansConfProperty: {"value1":"cust_param_name","value2":"agama_flow","hide":false,"description":""}
jansConfProperty: {"value1":"default_flow_name","value2":"","hide":false,"description":""}
jansEnabled: true
jansLevel: 10
jansModuleProperty: {"value1":"usage_type","value2":"interactive","description":""}
Expand Down

0 comments on commit 3b2248f

Please sign in to comment.