Closed desertTown closed 4 years ago
Sorry for the late response. AADAppRoleStatelessAuthenticationFilter
only accepts ID token as far as I know.
I was not accurate about my last comment.
The Invalid signature
is probably caused by trying to decode an access token which is issued for accessing Microsoft Graph. You could check the token on jwt.ms or jwt.io to check the audience. If you get "aud": "https://graph.microsoft.com"
then such access token should not be passed to AADAppRoleStatelessAuthenticationFilter
.
If your front end is the same application as the backend application, you could pass the ID token to the backend. And if not, you could request an access token for your application with your app's scope.
You could also check this issue.
@saragluna yes, you're right. if the "aud" is "https://graph.microsoft.com", I cannot pass the AADAppRoleStatelessAuthenticationFilter, After I using refresh token to reget the accessToken in different scope, the JWT return with aud": "api://{{my-clientId}}", this token can pass the AADAppRoleStatelessAuthenticationFilter
Thanks for your reply
Environment
Spring boot starter:
OS Type: Windows
Java version:
Summary
Hi, I am follow this sample project and try to test authorize code flow base role https://github.com/microsoft/azure-spring-boot/tree/master/azure-spring-boot-samples/azure-active-directory-v2-spring-boot-backend-sample
I have follow the README.md and replace the application.properties using v2.0 url
after login, I can acquire acessToken and refreshToken successfully.
but once I using VueClient with acessToken as Authentication header to call the SpringBoot resource API. Filter 'AADAppRoleStatelessAuthenticationFilter' will try to check the acessToken in header. and it will throw Exception
this acessToken will work on call graph API. etc:
could you please explain what reason may cause this Exception "BadJWSException: Signed JWT rejected: Invalid signature"
and one more question: this AADAppRoleStatelessAuthenticationFilter can work with acessToken? or it just only for id_Token?
Reproduce steps
Expected Results
should call SpringBoot resource API successfully
Actual Results
Exception "BadJWSException: Signed JWT rejected: Invalid signature" occur.