Skip to content

Conversation

@jimboy3100
Copy link

This update enhances the OAuth2ClientAuthenticationFilter by adding the method validateClientAuthenticationMethod(Authentication authentication). This method ensures that client authentication methods requiring a client secret have it included in the authentication process. Additionally, the getClientSecret() method has been added to the OAuth2ClientAuthenticationToken class. These changes ensure compliance with the Client Authentication specifications outlined in the OAuth 2.0 RFC.

		OAuth2AuthorizationRequest authorizationRequest = authorization.getAttribute(
				OAuth2AuthorizationRequest.class.getName());
		String codeChallenge = (String) authorizationRequest.getAdditionalParameters()
        				.get(PkceParameterNames.CODE_CHALLENGE);
     Improved error handling with more descriptive error messages.
     Enhanced logging to provide more information during the authentication process.
     Added checks for null authorization request and unsupported code challenge methods.
     Made the code more concise and readable by simplifying conditionals and refactoring repetitive code.
Prior to this commit, error handling and logging in the OAuth2 authorization process could be improved. This commit enhances the error handling to provide slightly more descriptive error messages and improves logging to include additional information during the authentication process.

Changes made:
- Improved error handling to provide slightly more descriptive error messages.
- Enhanced logging to include additional information during the authentication process.

The code previously relied on OAuth2AuthorizationRequest to retrieve the authorization request, which could potentially lead to a 'NullPointerException' if the request was not properly initialized. This commit ensures that the authorization request is retrieved safely.
This commit adds a new method, getClientSecret(), to the
OAuth2ClientAuthenticationToken class. This method allows retrieving
client secrets for confidential clients during client authentication.
Before this commit, there was no method available to directly fetch
the client secret from the OAuth2ClientAuthenticationToken class.
@jimboy3100 jimboy3100 marked this pull request as draft March 19, 2024 05:14
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 19, 2024
@jgrandja
Copy link
Collaborator

Closing as duplicate of gh-1576

@jgrandja jgrandja closed this Mar 22, 2024
@jgrandja jgrandja self-assigned this Mar 22, 2024
@jgrandja jgrandja added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: duplicate A duplicate of another issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants