spring-projects / spring-projects/spring-security

OidcAuthorizationCodeAuthenticationProvider easier to extend

Open
#12,611 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: oauth2 type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Expected Behavior

I would like to be able to use and modify OidcAuthorizationCodeAuthenticationProvider and the functionalities it provides a bit easier. The general usecase is that I already implemented a custom OAuth2AuthorizationRequestResolver that handles OIDC requests, so that includes setting the nonce to a specific value rather than it being a hashed random value like in the DefaultOAuth2AuthorizationRequestResolver. The OidcAuthorizationCodeAuthenticationProvider later does nonce validation and assumes the nonce in the token to be a hashed value and that the stored AuthRequest object has a non-hashed value and that those two can be compared. This validation method is a private method and cannot be extended easily, it'd be great if this nonce validation method were protected instead.

Current Behavior

private void validateNonce(OAuth2AuthorizationRequest authorizationRequest, OidcIdToken idToken)

This method is private and if we were to extend OidcAuthorizationCodeAuthenticationProvider we cannot override its behavior.

Context

I am using this part of spring security in order to create a wide variety of auth requests in order to interact with an identity provider for testing purposes. Being able to customize and modify existing classes that come out of the box would be greatly appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating OidcAuthorizationCodeAuthenticationProvider and its private validateNonce(OAuth2AuthorizationRequest, OidcIdToken) method, then inspect related tests and extension points. Done means subclasses can override nonce validation while existing behavior remains covered by the test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, security
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.