spring-projects / spring-projects/spring-data-rest

In @RepositoryRestController AuthenticationPrincipalArgumentResolver (@AuthenticationPrincipal) not involved [DATAREST-1312]

Open
#1,672 1 comment 2 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug type: task
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Grigory Kislin opened DATAREST-1312 and commented

Test project located at https://github.com/gkislin/spring-data-rest-authentication-principal

Check with  [admin@javaops.ru|mailto:admin@javaops.ru] / admin:

https://github.com/gkislin/spring-data-rest-authentication-principal/blob/master/src/main/java/ru/javaops/bootjava/restaurantvoting/web/VoteController.java#L54

http://localhost:8080/api/votes/current

OK, AuthenticationPrincipalArgumentResolver involved

https://github.com/gkislin/spring-data-rest-authentication-principal/blob/master/src/main/java/ru/javaops/bootjava/restaurantvoting/web/RestaurantController.java#L39

[http://localhost:8080/api/restaurants/3/vote]
java.lang.NullPointerException: nulljava.lang.NullPointerException: null at ru.javaops.bootjava.restaurantvoting.AuthUser.<init>

AuthenticationPrincipalArgumentResolver doesn't involved.
SecurityContextHolder.getContext().getAuthentication() works fine


Affects: 3.1.3 (Lovelace SR3)

Reference URL: https://github.com/gkislin/spring-data-rest-authentication-principal

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.