Skip to content

Instantly share code, notes, and snippets.

@srinivasanagandla-okta
Last active May 7, 2019 21:34
Show Gist options
  • Save srinivasanagandla-okta/3cd9af5428bf5199a976ad50815b7c52 to your computer and use it in GitHub Desktop.
Save srinivasanagandla-okta/3cd9af5428bf5199a976ad50815b7c52 to your computer and use it in GitHub Desktop.

alt text

Example 1

Chain:
    Step 1 -> [facebook, google]
        Step 2 -> [password]
            Step 3 -> [sms]
        Step 2 -> [webauthn]

Request JSON

POST "/api/v1/verificationMethods"

{
    "name": "....",
    "type": "chains",
    "chains": [
        { 
            "criteria": [ //Step 1 factors
                {
                    "factor": {
                        "type":"claims_provider",
                        "profile": {
                            "id": "facebook profile id"
                         }   
                    },
                    "factor": {
                        "type":"claims_provider",
                        "profile": {
                            "id": "google profile id"
                         }   
                    }
                }
            ],
            "next": [
                {
                    "criteria": [ //Step 2 factors
                        {
                            "factor": {
                                "type": "password"
                            }
                        }
                    ],
                    "next": [
                        {
                            "criteria": [ //Step 3 factors
                                {
                                    "factor": { 
                                        "type": "sms"
                                    }
                                }
                            ]
                        }
                    ]
                },
                {
                    "criteria": [ //Step 2 factors
                        {
                            "factor": {
                                "type": "webauthn"
                             }
                        }
                    ]
                }
            ]
        }
    ]
}    

Example 2

Chain 1:
    Step 1 -> [sms, call]
        Step 2 -> [webauthn]

Chain 2:
    Step 1 -> [password]
        Step 2 -> [email]

Request JSON

POST "/api/v1/verificationMethods"

{
    "name": "....",
    "type": "chains",
    "chains": [
        { //1st chain
            "criteria": [ //Step 1 factors
                {
                    "factor": {
                        "type": "sms"
                     }
                },
                {
                    "factor": {
                        "type": "call"
                    }
                }
            ],
            "next":[ //Step 2 factors
                {
                    "criteria": [
                        {
                            "factor": {
                                "type":"webauthn"
                            }
                        }
                    ]
                }
            ]
        },
        { //2nd chain
            "criteria": [ //Step 1 factors
                {
                    "factor": {
                        "type": "password"
                    }
                }
            ],
            "next": [
                {
                    "criteria": [ //Step 2 factors
                        {
                            "factor": {
                                "type": "email"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}
@srinivasanagandla-okta
Copy link
Author

srinivasanagandla-okta commented May 7, 2019

If criteria is confusing we could use the object type as factors, so the chain object would look like this:

chains = [
   {
         "factors": [ {"type":"sms"},  {"type":"call"} ],
         "next": [ { "factors": [], "next": []}, {....}]   
   },
   {
       2nd chain
   },
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment