-
In SpringBoot controllers, we can inject certain spring-managed beans such as Authentication, Principal, etc.
In the example above, spring will inject the authentication which is used by the @PreAuthorized annotation to determine access to the endpoint. This doesn't seem to be supported in DGS.
The authentication is always null in this case. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
That pattern is not currently supported, that said, recent changes in master will make this possible in the near future. In the meantime, you could use the SecurityContextHolder to fetch the Authentication from thread local. Please consider that the bean exposing the method used for data fetching is a managed bean and you can inject in its constructor any other bean that you want. |
Beta Was this translation helpful? Give feedback.
-
Hi @berngp , has there been any change in this do you know? |
Beta Was this translation helpful? Give feedback.
-
Hi @etylermoss, not sure. Tagging @srinivasankavitha and @kilink just in case they are aware of a change that will allow
|
Beta Was this translation helpful? Give feedback.
That pattern is not currently supported, that said, recent changes in master will make this possible in the near future. In the meantime, you could use the SecurityContextHolder to fetch the Authentication from thread local.
Please consider that the bean exposing the method used for data fetching is a managed bean and you can inject in its constructor any other bean that you want.