Skip to content

Commit

Permalink
feat: publish agama-sms project
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Mar 20, 2024
1 parent bc8447d commit 2440554
Show file tree
Hide file tree
Showing 20 changed files with 3,879 additions and 2 deletions.
1 change: 1 addition & 0 deletions LICENSE
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/
Expand Down
4 changes: 2 additions & 2 deletions README.md
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
1 change: 1 addition & 0 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
### Web folder
47 changes: 47 additions & 0 deletions code/org.gluu.agama.sms.main.flow
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
Loading

0 comments on commit 2440554

Please sign in to comment.