Guided Approach Towards Implementing Client Initiated Back-channel Authentication

Episode 05 — New Approach towards CIBA

Vivekvinushanth Christopher
Authenticate
6 min readOct 22, 2019

--

Fig.1. Evolution [ https://www.istockphoto.com/it/vettoriale/evolution-of-robots-technological-progress-gm1148349877-310094256]

Time has answers; Answers everything and everyone. It answers your pains. It answers your failures. It answers your falls. It answers your tears that only your pillow knows of. Time has an answer for the broken YOU. Time has an answer for people who broke you. Time answers your will and wit. Time answers your appetite for victory. Time answers your evolution. Time assist in evolution.

Time evolves — Time allows everything to evolve.

We had several concerns, ended up in architecture for POC of CIBA [Episode 03]. Our main concern was the load on IS[Identity Server] because of polling and have a minimized patch over the existing architecture of WSO2-IS.With that particular Proxy approach, we implemented a POC and had a demonstration as well [Episode 04].

But discussions and design reviews improve our thoughts and made us realize that it would be better if we stay as a monolithic architecture so that we can render more secured feature and we could satisfy the deployment pattern of WSO2-IS.

Though it is painful to drop the architecture approach V1.0 as described in Episode 03 , the evolution of architecture makes working more interesting and we had a drift: towards architecture approach V2.0.

Why this Approach??

It is to adhere to the standard deployment pattern of the WSO2 -IS.

The Approach

While the features and functionality remain the same as in V1.0, approach 2.0 pulls Ciba proxy as a component inside IS. Hence we need to partition proxy to several pieces and add them to the existing core architecture of WSO2-IS.

Hence, we have partitioned the Proxy into two main components

  1. CIBA Endpoint [Top left corner of Identity Server]
  2. CIBA Component [The violet box]
Fig.2. High-level Architecture and flow of CIBA feature in WSO2 IS

The Flow

Since the architecture had a drift, the flow of the feature also faced some changes. Though the high-level concept of decoupled authentication and polling mechanism for tokens remains unchanged we are forced to do adapt the changes that architecture has brought. But still, the flow will follow the preaching of the specifications.

Fig.3. The sequence flow of the process that provides the CIBA feature -WSO2 IS.

The Di-section of FLOW

It would be good to consider the flow mentioned in Fig.2. into three phases.

  1. Phase — 1 [2 - 6]
  2. Phase — 2 [7 -13]
  3. Phase — 3 [#1 - #4]

Phase — 1 [ Authentication Requests & Responses]

Fig.4. FlowChart of the processes in Phase-1
  1. EndPoint receives the CIBA AuthenticationRequest [Step 2 of Fig.2.]

2. Validation Process [Step 3 of Fig.2.]

  • isValidClient — This is to check whether the client who is initiating the request exists [registered] in Identity Server.
  • isValidUser — This is to check whether the user denoted by hints exists [registered] in identity Server.
  • isValidUserCode — This is to verify the usercode against the user for whom the authentication request is made [WSO2 IS hasn’t planned to provide the support for this at the first release. But given as an extensible point where a developer can implement logic accordingly]
  • isValidRequest— This is to check for the presence of mandatory parameters and whether values given are proper and valid.

3. Persist required parameters [Step 3 of Fig.2.]

Here parameters required for the functioning of the flow will be stored.

4. Create auth_req_id

  • auth_req_id will be a signed JWT

5. Return Authentication Response [Step 5 of Fig.2.]

  • Error Response[if parameters missing]:
  • Error Response [if unauthorized client]

6. Fire Authorization Request [Step 6 of Fig.2.]

  • This will be an async HTTP call to the authorize endpoint of WSO2 -IS with required parameters.

Note :

* We will discuss in detail about the requests, responses, validations, parameters involved in a later episode.

* And also we will sooner discuss about the components,packages and the classes and the methods involved in the flow.

Phase — 2 [ Authentication & Authorization]

  • This phase is almost controlled by the authentication framework, local/outbound authenticators of WSO2 -IS
  1. Inbound-OAuth-Auth component receives the authorization request.
  2. Inbound-OAuth-Auth triggers the Authentication Framework to continue authorization process [step 7 in Fig.2.].
  3. Authenticators and Authentication framework take care of multistep authentication [steps 8–11 in Fig.2.].
  4. Once properly authenticated & authorized by giving the consent, the control is again given to Ciba Component [step 12 in Fig.2.].
  5. Ciba Component update Authentication/Authorization responses in the storage [step 13 in Fig.2.].

Phase — 3 [Token Request, Token Response & Polling]

Fig.5. FlowChart of the processes in Phase-3

In this last phase of the flow, clients will be polling for a token at the token endpoint of WSO2-IS.

  1. Token Request has to be made towards the Token endpoint of WSO2-IS [Step #1 of Fig.2.]
  • Sample TokenRequest

2. Identity Server then validates the request [Step #2 of Fig.2.]

  • isValidGrant — This is to check whether the granType mentioned in the request is registered and authorized for the client who made the request.
  • isValidClient — This is to check whether the client who is initiating the request exists [registered] in Identity Server.
  • isPollingAllowed— This is to check whether the client who is polling at the token endpoint is authorized to poll. For the first release, has not been planned to support ‘Ping Flow’, but given as an extensible point for the implementers to extend support.
  • ActiveAuthReqID — This is to confirm whether the auth_req_id with which the request is made is active and be provided by IS itself.
  • CorrectPollingFrequency — This is to confirm the correct polling frequency of the token request

3. Identity Server checks for Authentication status [Step #3 of Fig.2.]

  • isUserAuthenticated— This is to check whether the user specified by the auth_req_id has been authenticated and authorized.

4. Provide Tokens [Step #4 of Fig.2.]

  • If steps #2,#3 are affirmative return proper token response.
  • Return error response if validations failed [The error descriptions vary according to the validations that the token had failed across].
  • Eg: ErrorResponse when polling frequency is improper.

In this episode of CIBA series, we have seen our new approach to implement CIBA support for WSO2 IS. We have implemented the logic for the full functioning flow of CIBA. From below repositories, one can find the implementation of the components

  1. org.wso2.carbon.identity.oauth2.endpoint.ciba
  2. org.wso2.carbon.identity.oauth.ciba

We love breaking Ciba architecture further into bits and pieces so that everyone can understand the view of us on implementing Ciba. You’ve heard of 4+1 view? The next episode is going to be picturesque. Keep waiting !.

Happy Learning.

--

--