Skip to content

Authorize with anonymous principal if principal name is null#1050

Merged
OlgaMaciaszek merged 1 commit intospring-cloud:4.1.xfrom
agileknight:authorize-with-anonymous-when-principal-name-is-null
Sep 5, 2024
Merged

Authorize with anonymous principal if principal name is null#1050
OlgaMaciaszek merged 1 commit intospring-cloud:4.1.xfrom
agileknight:authorize-with-anonymous-when-principal-name-is-null

Conversation

@agileknight
Copy link
Copy Markdown
Contributor

The authorizedClientManager.authorize method requires a non-null principal name or it will usually throw an exception in practice like "principalName cannot be empty".

Using the anonymous principal in this case like for a null principal handles the situation more gracefully.

Fixes #1049

@pivotal-cla
Copy link
Copy Markdown

@agileknight Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link
Copy Markdown

@agileknight Thank you for signing the Contributor License Agreement!

@agileknight agileknight marked this pull request as ready for review August 19, 2024 15:54
@OlgaMaciaszek OlgaMaciaszek added bug Something isn't working and removed waiting-for-triage labels Sep 4, 2024
Copy link
Copy Markdown
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @agileknight. Thanks for submitting the PR. In general, looks good. Please add your name with @author tag to the javadocs of all the files you've modified. Please update the date in the license comment in the files you've modified to 2015-2024.
Also, please submit this PR against 4.1.x instead, so that it also gets included in the 2023.0.x release train.

Copy link
Copy Markdown
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some build tests are failing. Please take a look.

@OlgaMaciaszek OlgaMaciaszek self-assigned this Sep 4, 2024
@agileknight agileknight force-pushed the authorize-with-anonymous-when-principal-name-is-null branch 2 times, most recently from 751040d to 8304aec Compare September 5, 2024 16:05
The authorizedClientManager.authorize method requires
a non-null principal name or it will usually throw
an exception in practice like "principalName cannot be empty".

Using the anonymous principal in this case like for
a null principal handles the situation more gracefully.

Fixes spring-cloud#1049
@agileknight agileknight force-pushed the authorize-with-anonymous-when-principal-name-is-null branch from 8304aec to ab8d462 Compare September 5, 2024 16:12
@agileknight agileknight changed the base branch from main to 4.1.x September 5, 2024 16:12
@OlgaMaciaszek OlgaMaciaszek merged commit c1988b8 into spring-cloud:4.1.x Sep 5, 2024
Copy link
Copy Markdown
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @agileknight. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OAuth2AccessTokenInterceptor can handle Authentication Principal where principalName is null

4 participants