Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: update expected status code #10618

Merged
merged 2 commits into from
Jan 14, 2025
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
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
Loading