Skip to content

Commit

Permalink
fix(agama): update expected status code (#10618)
Browse files Browse the repository at this point in the history
* fix: fix broken test

Signed-off-by: jgomer2001 <[email protected]>

* docs: minor doc update #10617

Signed-off-by: jgomer2001 <[email protected]>

---------

Signed-off-by: jgomer2001 <[email protected]>
  • Loading branch information
jgomer2001 authored Jan 14, 2025
1 parent 41bf8b8 commit c0dce75
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
48 changes: 46 additions & 2 deletions docs/janssen-server/developer/agama/native-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,53 @@ This hypothetical flow is simple but will give you a good idea on how to interac

### The flow code

The following code depicts the implementation.
The below depicts the implementation:

![enabled-2fa-methods](../../../assets/agama/challenge-flow.png)
![co.acme.flows.emailOtp](../../../assets/agama/challenge-flow.png)

<!--
Flow co.acme.flows.emailOtp
Basepath "..."
obj = RRF "username-prompt.ftl"
username = obj.username
// Assumptions:
// - username property holds the user name (in obj map)
// - retrieveEmails method returns a list of e-mail addresses associated to the user
// - the username entered always references an existing user
emails = Call co.acme.services.UserService#retrieveEmails username
size = emails.length
When size is 0
obj = { success: false, error: "No e-mails associated to this account" }
Finish obj
When size is 1
email = emails[0]
Otherwise
inj = { addresses: emails }
obj = RRF "email-prompt.ftl" inj
// Assumption: obj.email contains the address the user chose
email = obj.email
passcode = Call co.acme.services.EmailService#sendRandomOTP email
// Assumption:
// - method sendRandomOTP sends a message to the address passed and returns the OTP included in the message
obj = RRF "passcode-prompt.ftl"
// Assumption: obj.otp contains the code the user entered
When obj.otp is passcode
// The next line is shorthand for { success: true, data: { userId: data.username } }
Finish username
obj = { success: false, error: "Wrong code entered. Try again another day" }
Finish obj
-->

Flow `co.acme.flows.emailOtp` is self-explanatory and does not require further insight. Note the templates referenced in RRF directives don't necessarily have to exist, however, the template names will be included in the output of the endpoint as the flow executes. This serves as a hint or reference for the app to know the current point of execution and determine what should be shown in the UI. It will be more clearly seen in the next section.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void withTimeout() {
int status = page.getWebResponse().getStatusCode();
String text = page.getVisibleText().toLowerCase();

if (status == 200) {
if (status == 410) {
//See timeout.ftlh
assertTextContained(text, "took", "more", "expected");
} else if (status == 404) {
Expand Down

0 comments on commit c0dce75

Please sign in to comment.