checkFlowCompleted checks if a registration flow complies with any allowed flow dictated by the server. Order of stages does not matter. A user may complete extra stages as long as the required stages of at least one flow is met.
( flow []authtypes.LoginType, allowedFlows []authtypes.Flow, )
| 991 | // dictated by the server. Order of stages does not matter. A user may complete |
| 992 | // extra stages as long as the required stages of at least one flow is met. |
| 993 | func checkFlowCompleted( |
| 994 | flow []authtypes.LoginType, |
| 995 | allowedFlows []authtypes.Flow, |
| 996 | ) bool { |
| 997 | // Iterate through possible flows to check whether any have been fully completed. |
| 998 | for _, allowedFlow := range allowedFlows { |
| 999 | if checkFlows(flow, allowedFlow.Stages) { |
| 1000 | return true |
| 1001 | } |
| 1002 | } |
| 1003 | return false |
| 1004 | } |
| 1005 | |
| 1006 | type availableResponse struct { |
| 1007 | Available bool `json:"available"` |