Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get authentication information at method level? #113

Open
kamboj652 opened this issue Oct 28, 2021 · 1 comment
Open

How to get authentication information at method level? #113

kamboj652 opened this issue Oct 28, 2021 · 1 comment

Comments

@kamboj652
Copy link

kamboj652 commented Oct 28, 2021

I am trying to get autheticated user from jwt but i got null.

@GraphQLQuery
public Project test(String whatever, @GraphQLRootContext DefaultGlobalContext ctx) {

	System.out.println(ctx.getNativeRequest().getNativeRequest(HttpServletRequest.class).getAuthType()); // null
	return repo.test();
} 
@kaqqao
Copy link
Member

kaqqao commented Dec 18, 2022

Why not just use the usual SecurityContextHolder.getContext().getAuthentication()?
If you're on the reactive stack, use ReactiveSecurityContextHolder instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants