spring-projects / spring-projects/spring-session

Null Pointer Exception - Spring Boot, Spring Data Redis, Spring Session

Open
#992 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
1.9k
Forks
1.2k
Avg merge
4h 27m
Merged PRs (30d)
55

Description

I am trying to use Spring Session, Spring Data Redis with Spring Security as well as Spring boot, so that we can save the user as well as all the session data into Redis, the main objective of this would be load balancing, so that sessions will not be affiliated to a particular tomcat server, and we could take tomcats down, and requests for a particular client would still be served via other tomcats, since sessions will be available via Redis.

In the application which I am trying to do this, I have upgraded to Spring Boot Release 1.5.9.RELEASE, with Spring Security version 4.2.3.RELEASE.

We are facing road blocks when we authenticate a user, and the user navigates to second page. To be more clear I have created a sample of a similar situation here(https://github.com/kashipai/spring-security-redis-sample/tree/master/complete), I have taken the Spring guide, and modified it similar to as to how it is in our project.

I have tried debugging the problem with eclipse, and I understand that the issue is to do with the deserialization of the Authentication Object from Redis, where in while fetching the entries of Authorities Object, it fails and returns null, and If in the Security Configuration there is a rule for a URL with hasAnyAuthority() then it throws a null pointer exception.

Any help or pointers as to how to go about solving this issue would be very helpful.

I have tried opening up an issue in StackOverflow without any solution being available for more than a week, don't know whether raising a query like this here is proper, if not please close the issue.

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 with the complete sample application linked in the issue and reproduce authentication followed by navigation to a second page using Spring Boot 1.5.9.RELEASE and Spring Security 4.2.3.RELEASE. Inspect the Redis deserialization path for the Authentication object's authorities and confirm the hasAnyAuthority() request is handled without a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring-boot
Domain
authentication, backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.