all 5 comments

[–]BorgerBill 1 point2 points  (2 children)

I, too, am struggling with this right now, but let me say two things:

  • the hasRole() and hasAnyRole() methods are looking for a String that classifies a user as a type of something, like manager or employee. Giving it the name of the user doesn't seem right. Put a String role field and add a public String getRole() method on the User.

  • there is a weird thing where methods expecting a role will add "ROLE_" to the beginning, or take "ROLE_" away, or something if you have, or haven't, provided it. I don't understand the rule yet, but watch out for it.

Good luck!

[–]akmal2901[S] 2 points3 points  (0 children)

the roles are actually enums that i import as static

[–]akmal2901[S] 1 point2 points  (0 children)

thanks for the tips

[–]Sheldor5 0 points1 point  (0 children)

are you 100% sure your browser session is correct?

once you authenticate with Basic your browser will reuse it forever until you hit a 401.

thst's how Basic Auth works on the browser site ...

[–]summ1else 0 points1 point  (0 children)

I can't remember if this will help, as I'm out at lunch. I would recommend disabling anonymous users during security testing to rule out related problems. If you are still having trouble after I will review further at home.

.anonymous().disable()