-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add diagnostic logs to the authenticator #147
Conversation
PR builder started |
PR builder completed |
This method has been introduce since some other authenticators extends the OpenIDConnectAuthenticator class and use its methods. In that case we need to change the component id of those repos. That's why this method was introduced
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Outdated
Show resolved
Hide resolved
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Outdated
Show resolved
Hide resolved
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Outdated
Show resolved
Hide resolved
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Show resolved
Hide resolved
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Outdated
Show resolved
Hide resolved
...java/org/wso2/carbon/identity/application/authenticator/oidc/OpenIDConnectAuthenticator.java
Outdated
Show resolved
Hide resolved
components/org.wso2.carbon.identity.application.authenticator.oidc/pom.xml
Show resolved
Hide resolved
PR builder started |
PR builder completed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/5866716321
Proposed changes in this pull request
Approach
Diagnostic logs will be covered the green-colored actions/validations of the authentication process.
Authentication Request Validation
Within each authenticator, the
initiateAuthenticationRequest
method houses the logic for this step. This triggers two diagnostic logs. The first log indicates the initialization of the authentication request, and the second log shows the authentication request has been successfully sent – whether it's a Success or marked Invalid.Validate Authentication Response
The
processAuthenticationResponse
method handles authentication responses sent by the federated IDP. Once users are sent to the federated IDP page and complete the login, the authenticator receives an authentication response sent by the federated IDP, which this method manages. Just like the request validation, this step also generates two diagnostic logs. The first one marks the beginning of response validation, while the second one is only created if the authentication is successful. We've chosen not to include logs for authentication response failures for a couple of reasons:Additionally, there will be another diagnostic log that will get published from the canHandle() method of the authenticator. The
canHandle
method gets executed each time before theinitiateAuthenticationRequest
andprocessAuthenticationResponse
get executed. This log is published as an internal log for our internal developers. The purpose of this log is to verify whether the auth request/response was passed into the authenticator to handle it.I've also introduced a new protected method named getComponentId. This addition serves a specific purpose. The OpenIDAuthenticator class extends into other Authenticators like GitHub and Google. These extended Authenticators utilize the initiateAuthenticationRequest and processAuthenticationResponse methods from the OpenIDAuthenticator class. However, this can lead to diagnostic logs being attributed to the OIDC authenticator even when they're handled by the relevant Authenticator (with no change in the component ID of the logs).
To address this, I've implemented the getComponentId method. This method returns the component ID. When each Authenticator (like Google or Github) overrides this method, the component ID in the logs gets adjusted accordingly. This ensures that the logs correctly reflect the handling Authenticator.