Ask Your Question

Why am I not granted permissions when using ".requestMatchers("/").hasAnyAuthority("admin", "staff").anyRequest().authenticated()"?

asked 2022-06-30 11:00:00 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-04-07 17:00:00 +0000

bukephalos gravatar image

There could be several reasons why you are not granted permissions when using ".requestMatchers("/").hasAnyAuthority("admin", "staff").anyRequest().authenticated()":

  1. You may not have the "admin" or "staff" authority. Make sure that your user account has been assigned one of these authorities.

  2. Your authentication provider may not be correctly configured to provide the necessary authorities. Check your authentication configuration to make sure that your provider is configured to authenticate users and provide authorities.

  3. Your request may not be mapped correctly to the URL pattern ("/"). Make sure that your request is correctly mapped to this URL pattern.

  4. There may be a problem with your authorization configuration. Check your authorization configuration to make sure that your rules are correctly configured and applied in the correct order.

It is also possible that there are other issues that are causing the problem. If you cannot resolve the issue on your own, you may need to seek additional help from a developer or technical support.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-06-30 11:00:00 +0000

Seen: 12 times

Last updated: Apr 07 '21