-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
3,879 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
This file contains 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# agama-sms | ||
Agama Project that utilizes sending an SMS OTP to verify control of a mobile device | ||
### agama-sms | ||
OTP authentication with SMS |
This file contains 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 @@ | ||
### Web folder |
This file contains 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,47 @@ | ||
// Start the excecution of the main flow | ||
Flow org.gluu.agama.sms.main | ||
Basepath "" | ||
Configs conf | ||
// Create variable to receive validation result. | ||
validationResult = {} | ||
// Get an instance of OTPService Class. | ||
otpService = Call org.gluu.agama.sms.OTPService#getInstance conf | ||
// Iterate x times maximum. | ||
count = Repeat 3 times max | ||
// Retrieve user credentials from UI. | ||
credentials = RRF "login.ftlh" validationResult | ||
// Log the successfull used credentials retrieval. | ||
Log "@info Log the successfull used credentials retrieval." | ||
// Validate provided user credentials. | ||
validationResult.status = Call otpService validateCreds credentials.username credentials.password | ||
// If user credentials is valid | ||
When validationResult.status is true | ||
// add entry in log file for successfull login attempt. | ||
Log "@info Valid credentials provided for user: " credentials.username | ||
// Generate and send OTP code to authenticated user. | ||
maskedPhone = Call otpService sendOTPCode credentials.username | ||
// Assign username variable. | ||
username = credentials.username | ||
// The OTP Code has been send to user. | ||
Log "@info OTP generated and send to: " maskedPhone | ||
// Trigger OTP subflow | ||
otpFeedBack | otpException = Trigger org.gluu.agama.sms.otp otpService username maskedPhone | ||
// OTP Code validation is completed. | ||
Log "@info OTP Code validation completed with status: " otpFeedBack | ||
// Check if OTP validation vas okay | ||
When otpFeedBack.success is true | ||
// The main flow has completed successfully. | ||
it_knult = {success:true, data: { userId: credentials.username}} | ||
Finish it_knult | ||
// Closing the main flow with error. | ||
it_wnfrb = {success:false, error: "The flow has been completed with error."} | ||
Finish it_wnfrb | ||
// Invalid credentials provided. | ||
Log "@error Invalid credentials provided." | ||
// Provide feedback about the error message to user. | ||
validationResult.errorMessage = "The provided credentials are not valid. Please try again!" | ||
// Maximum attempts reached. Password validation failed! | ||
Log "@info Maximum attempts reached. Password validation failed!" | ||
// Maximum attempts reached. Password validation failed! | ||
it_rknrg = {success:false, error: "Password validation failed!"} | ||
Finish it_rknrg |
Oops, something went wrong.