• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Spring Role Hierarchy: NullPointerException

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to implement Role hierarchy and then use it in method security.
For the simplicity its just two roles here: ADMIN and GOAL. ADMIN includes GOAL.
I created RoleHierarchy Bean in a separate Configuration file, because some people here stated that Spring Security filters need to be configured quite early.

I'm getting following errors:
When I'm accessing the controller I'm getting a NullPointer error (which stated below)
Another controllers which stated in antMatchers stops working too with the same error.

Questions:
1.Where is the error?
2.Do I need to declare my custom hierarchy in GlobalMethodSecurityConfiguration or WebSecurityConfigurerAdapter or both?

Source code:


RoleHierarchy Bean


GlobalMethodSecurityConfiguration


WebSecurityConfigurerAdapter


Controller
Tried to also use @PreAuthorize("hasRole('ROLE_GOAL')" or @PreAuthorize("hasRole('GOAL')".


Error when accesssing the controller:
 
reply
    Bookmark Topic Watch Topic
  • New Topic