forked from Telodendria/Telodendria
Multi-stage flows should theoretically work now.
This commit is contained in:
parent
e4ec250d8f
commit
0cbdb5f615
2 changed files with 12 additions and 4 deletions
4
TODO.txt
4
TODO.txt
|
@ -16,8 +16,8 @@ Milestone: v0.2.0
|
||||||
- Reference it all the places it's needed
|
- Reference it all the places it's needed
|
||||||
- Finish implementing JSON parsing
|
- Finish implementing JSON parsing
|
||||||
|
|
||||||
[ ] User Interactive Authentication
|
[x] User Interactive Authentication
|
||||||
[ ] Fix UiaComplete so we can use multi-stage flows
|
[x] Fix UiaComplete so we can use multi-stage flows
|
||||||
|
|
||||||
[x] User login
|
[x] User login
|
||||||
[x] Logout all
|
[x] Logout all
|
||||||
|
|
12
src/Uia.c
12
src/Uia.c
|
@ -212,6 +212,7 @@ UiaComplete(Array * flows, HttpServerContext * context, Db * db,
|
||||||
char *authType;
|
char *authType;
|
||||||
Array *completed;
|
Array *completed;
|
||||||
Array *possibleNext;
|
Array *possibleNext;
|
||||||
|
int remaining[16]; /* There should never be more than this many stages in a flow, right? */
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
DbRef *dbRef;
|
DbRef *dbRef;
|
||||||
|
@ -278,6 +279,7 @@ UiaComplete(Array * flows, HttpServerContext * context, Db * db,
|
||||||
UiaStage *stage = ArrayGet(stages, ArraySize(completed));
|
UiaStage *stage = ArrayGet(stages, ArraySize(completed));
|
||||||
|
|
||||||
ArrayAdd(possibleNext, stage->type);
|
ArrayAdd(possibleNext, stage->type);
|
||||||
|
remaining[ArraySize(possibleNext) - 1] = ArraySize(stages) - ArraySize(completed);
|
||||||
}
|
}
|
||||||
else if (ArraySize(stages) == ArraySize(completed))
|
else if (ArraySize(stages) == ArraySize(completed))
|
||||||
{
|
{
|
||||||
|
@ -413,8 +415,14 @@ UiaComplete(Array * flows, HttpServerContext * context, Db * db,
|
||||||
|
|
||||||
ArrayAdd(completed, JsonValueString(authType));
|
ArrayAdd(completed, JsonValueString(authType));
|
||||||
|
|
||||||
ret = 1; /* TODO: Only return 1 if there are
|
if (remaining[i] - 1 > 0)
|
||||||
* remaining stages */
|
{
|
||||||
|
HttpResponseStatus(context, HTTP_UNAUTHORIZED);
|
||||||
|
ret = BuildResponse(flows, db, response, session, dbRef);
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
ArrayFree(possibleNext);
|
ArrayFree(possibleNext);
|
||||||
|
|
Loading…
Reference in a new issue