Repository navigation
KEYCLOAK-12137 OpenID Connect Client Initiated Backchannel Authentication (CIBA) - #7679
Conversation
|
@mposolda As mentioned in the 8th meeting of FAPI-SIG, I sent at first the PR for the pure CIBA support. This PR is still huge so that I will add detailed comments on the commits to help the reviewer grasp them. |
84fe84e to
47f206a
Compare
47f206a to
4663334
Compare
|
In these comments here, the following external resources are referred. I've added and referred this implementation practical guide because it seems to be difficult to describe this PR by only these comments here. |
Set as Preview FeatureThis PR sets the CIBA support as the preview feature. The following two points check whether the CIBA support is activated or not and refuse the request from the client as CD(Consumption Device) if the CIBA support is not activated.
Related codes
Corresponding description on the design documentNot mentioned. Corresponding description on the implementation practical guideNot mentioned. |
Backchannel Authentication EndpointThis PR defines the backchannel authentication endpoint as follows.
This endpoint's entry point is defined in This endpoint's url can be retrieved by Related codes
Corresponding description on the design documentSpecifications - Inside CIBA Protocol - Backchannel Authentication Endpoint Corresponding description on the implementation practical guidepage 19, KE-1: Backchannel Authentication Endpoint |
OpenID Provider MetadataThis PR supports the following two REQUIRED OpenID Provider Metadata.
Related codes
Corresponding description on the design documentDesign and Implementation - Server Metadata Corresponding description on the implementation practical guideNot mentioned. |
Configuration ItemsThe followings can be configured.
These configuration items can be set per realm. They can be realized as CIBA Policy. On Admin Console, this CIBA Policy is shown on Authentication tab. The model of this CIBA Policy is defined by These configuration items are stored as realm attributes. Related codes
Corresponding description on the design documentSpecifications - Settings - CIBA Policy Corresponding description on the implementation practical guideNot mentioned. |
Authentication FlowLike Browser Flow and Direct Grant Flow, this PR introduced dedicated authentication flow called "CIBA Flow" because the CIBA's authentication flow does not fit any other existing flow in keycloak. Like Browser Flow and Direct Grant Flow, CIBA Flow can be overridden by the flow specified per client. This PR provides the default authentication flow. AuthenticatorLike other flows, CIBA flow can include executors and sub flows. This PR provides the default authenticator When an authentication flow for CIBA is instantiatedIt is instantiated when the keycloak receives the result of AuthN(Authentication) and AuthZ(Authorization) by AD(Authentication Device) from the decoupled authentication server and verify this result. Related codes
Corresponding description on the design documentDesign and Implementation - Authentication Flow Corresponding description on the implementation practical guidepage 47, CIBA Flow : Authentication Flow/Execution |
Outside CIBA Protocol : AuthN & AuthZ Delegation Request/Delegation Request Accepted ResponseThe process after receiving the backchannel authentication has been implemented as the provider, namely sending AuthN & AuthZ Delegation Request to the decoupled authentication server and receiving the corresponding response. Related codes
It defines the interface for sending AuthN & AuthZ Delegation Request to the decoupled authentication server and receiving its response.
It is the factory class for
It defines SPI for
It defines the implementation for
It defines the actual implementation for
It is the factory class for Corresponding description on the design documentDesign and Implementation - From Backchannel Auth Req/Res part to AuthN/AuthZ by AD part Corresponding description on the implementation practical guidepage 48, CIBA Flow : Providers |
Outside CIBA Protocol : AuthN & AuthZ Result Notification/Result Notification ACKThe process after receiving AuthN & AuthZ Result Notification from the decoupled authentication server has been implemented as the provider. It requires a custom endpoint so that this provider realized it by implementing Related codes
It is the factory class for
It defines the actual implementation for Corresponding description on the design documentDesign and Implementation - From AuthN/AuthZ by AD part To Token Req/Res part Corresponding description on the implementation practical guidepage 48, CIBA Flow : Providers |
Outside CIBA Protocol : Settings about Decoupled Authentication ServerThe following items can be set by wildfly's setting file (standalone.xml, etc)
Related codesNothing. Corresponding description on the design documentNot mentioned. Corresponding description on the implementation practical guidepage 53, Run with Decoupled Auth Server Reference Implementation |
Session BindingOne CIBA protocol flow consists of the following HTTP requests/responses.
To bind these stateless requests/responses to identify one logical same CIBA protocol flow, use the identifier To share this To share this Related codes
Corresponding description on the design documentCorresponding description on the implementation practical guidepage 45, CIBA Flow : Session Binding |
Protocol Flow ContextThe one logical CIBA protocol flow is characterized by its context. To idenfity this logical CIBA protocol flow and recognizes its characteristics among keycloak, CD and the decoupled authentication server, use JWT encrypted Consindering the fact that CD sends the token request and the decoupled authentication server sends the AuthN & AuthZ by AD result to keycloak independently and asynchronously, keycloak use the infinispan distribution cache to retain this AuthN & AuthZ by AD result with Both Related codes
Corresponding description on the design documentDesign and Implementation - How to Implement Auth Result Cache Design and Implementation - Interface between Inside and Outside CIBA Protocol Corresponding description on the implementation practical guidepage 46, CIBA Flow : Context |
User ResolverThis PR implements the provider that converts the user representation on CD, keycloak and the decoupled authentication server. The default implementation of this provider only support Related codes
Corresponding description on the design documentExtensibility - AuthN/AuthZ User Resolver Corresponding description on the implementation practical guidepage 49, User Resolver |
Token Request ThrottlingTo prevent keycloak from being swamped with token requests from CD, keycloak rejects the token request arrived too much early. In order to do so, keycloak keeps information called This information is kept inside the node, not synchronized among other nodes to prevent the performance of synchronizing infinispan cache among nodes from being degraded. This PR uses simple To prevent it to be stacked infinitely after it is expired, This PR checks whether Related codes
Corresponding description on the design documentDesign and Implementation - Token Request Throttling Corresponding description on the implementation practical guidepage 50, Token Request Throttling |
Arquillian Integration TestFor testing CIBA, the decoupled authentication server is needed. This PR owes the role of this server to keycloak itself by modifying Instead of sending AuthN & AuthZ by AD result from the decoupled authentication server to keycloak, this PR makes For the decoupled authentication server settings, this PR modifies Related codes
It represents the AuthN & AuthZ Delegation Request from keycloak to the decoupled authentication server.
It adds the temporal queue holding the AuthN & AuthZ Delegation Request to the resource that can be used on the CIBA tests.
It defines the provider factory for
It adds the endpoint and its logic for receiving the AuthN & AuthZ Delegation Request.
It adds the dynamic configuration activation of the decoupled authentication server serttings for CIBA tests.
It adds the dynamic configuration for the decoupled authentication server serttings for CIBA tests.
It adds the getter for newly introduced endpoints for receiving and retrieving the AuthN & AuthZ Delegation Request.
It adds interfaces for newly introduced endpoints for receiving and retrieving the AuthN & AuthZ Delegation Request.
It defines jboss-cli commands for the dynamic configuration for the decoupled authentication server serttings for CIBA tests.
It adds utility methods for handling CIBA protocol.
It tests this PR's CIBA protocol support.
It adds the static configuration for the decoupled authentication server serttings for CIBA tests. Corresponding description on the design documentNot mentioned. Corresponding description on the implementation practical guideNot mentioned. |
|
@mposolda I've added detailed comments on the commits to help the reviewer grasp them. Hopefully you could review this PR. |
|
@tnorimat I was able to build a simple decoupled authentication service (or an authentication channel as per specs and per suggestions here) and it worked fine. To improve UX, maybe we should probably create a "CIBA" switch that once turned ON will automatically configure a CIBA flow and do the binding. That switch could be in "Realm Settings" (maybe we could have an "OpenID Connect" sub-section there) so that it makes it a lot easier to use the functionality. |
d7cfa34 to
8845be8
Compare
|
@mposolda I've updated codes incorporating your comment on #7679 (comment) , also rebased on the latest master. Could you check them? |
There was a problem hiding this comment.
@tnorimat Thanks, I am finally approving the PR
@pedroigor Do you have any more feedback for this PR?
|
@tnorimat @pedroigor @valb3r Merging now. Thanks everyone for the hard work on this! |
…tion (CIBA) (keycloak#7679) * KEYCLOAK-12137 OpenID Connect Client Initiated Backchannel Authentication (CIBA) Co-authored-by: Andrii Murashkin <amu@adorsys.com.ua> Co-authored-by: Christophe Lannoy <c4r1570p4e@gmail.com> Co-authored-by: Pedro Igor <pigor.craveiro@gmail.com> Co-authored-by: mposolda <mposolda@gmail.com>
This PR is for KEYCLOAK-12137 OpenID Connect Client Initiated Backchannel Authentication (CIBA), also is the part of the project FAPI-CIBA(poll mode) of FAPI-SIG activity.
Generally speaking, the aim of this PR is to support CIBA Flow defined in the design document.
However, this PR does not support Financial-grade API: Client Initiated Backchannel Authentication Profile
(FAPI-CIBA) feature. As mentioned in the 8th meeting of FAPI-SIG, I will send PRs for FAPI-CIBA features consecutively after this PR supporting pure CIBA being merged.
This PR is still huge so that I will add detailed comments on the commits to help the reviewer grasp them.
This PR has been written with the contribution by @andriimurashkin as FAPI-SIG activities..