-
Notifications
You must be signed in to change notification settings - Fork 17
/
org.gluu.agama.pw.main.flow
43 lines (43 loc) · 2.06 KB
/
org.gluu.agama.pw.main.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Flow org.gluu.agama.pw.main
Basepath ""
Timeout 500 seconds
Configs conf
Log "@info Start execution of the password validation flow."
// Create json variable for UI feedback.
uiFeedback = {}
// Get an instance of PasswordService Class.
validationService = Call org.gluu.agama.pw.PasswordService#getInstance conf
// Iterate x times max
count = Repeat 6 times max
// Retrieve user credentials from UI.
credentials = RRF "login-basic.ftlh" uiFeedback
// Log the successfull used credentials retrieval.
Log "@info User credentials collected successfully!"
// Validate provided user credentials.
uiFeedback.succeed = Call validationService validate credentials.username credentials.password
Log "@info Validation done"
// If user credentials is valid, the flow end successfully.
When uiFeedback.succeed is true
// add entry in log file for successfull login attempt.
Log "@info Valid credentials provided"
// Password validation completed successfuly!
it_aqzhf = {success:true, data: { userId: credentials.username}}
Finish it_aqzhf
// Invalid credentials provided.
Log "@error Invalid credentials provided"
When conf.ENABLE_LOCK is "true"
// Account lock feature is active.
Log "@info Start account lock process"
// Lock user account if needed or unlock if the expiration time is over.
lockResult = Call validationService lockAccount credentials.username
Log "@info Account lock result" lockResult
uiFeedback.lockMessage = lockResult
// Maximum attempts reached. Password validation failed!
Log "@info Maximum attempts reached. Password validation failed."
uiFeedback.errorMessage = "Invalid credentials. Please try again!"
uiFeedback.uid = credentials.username
// The login flow will end here with failure.
Log "@info The maximum login attempt has been reached!"
// Maximum attempts reached. Password validation failed!
it_hhjoo = {success:false, error: "Password validation failed!"}
Finish it_hhjoo