You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Micronaut Lambda RESTful application and I would like to restrict the usage of the API to only the clients that present as well a JWT token. The application will validate this token before honoring the request. (The validation will involve the Auth0 server to perform the actual authorization)
And finally, I copied the aot-jar.properties file containing the configs for JAR packaging AS-IS. With only these changes and nothing else, my very simple integration test failed:
The assertion failed because now the status code is 401 (UNAUTHORIZED)
Now, it is pretty obvious that I should expect this since there was no JWT token present.
Questions:
How do I set up an integration test that get past that JWT authorization phase ? (either by skipping it or by using a fake token)
Where do I specify my Auth0-related settings? Can these be mocked/stubbed in a test?
The guide does not say anything about securing or using JWT tokens with Lambda. Are there any docs/resources covering this scenario?
The JWT guide doesn't say what's the purpose of micronaut.security.token.jwt.signatures.secret.generator.secret property. Which API uses it?
The same JWT guide shows a test for the controller:
How is the "/login" resource served? there is no declaration for it in the controller.
Must I annotate my controller with @Secured(SecurityRule.IS_AUTHENTICATED) ? I don't need to perform any authentication process (I don't need/want to implement HttpRequestAuthenticationProvider)!
Is there an API that would just allow me to pass a JWT token to be validated by my Auth0 server?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Context
I have a Micronaut Lambda RESTful application and I would like to restrict the usage of the API to only the clients that present as well a JWT token. The application will validate this token before honoring the request. (The validation will involve the Auth0 server to perform the actual authorization)
micronaut-security-jwt to the rescue!
So after reading through Micronaut Security Guide and Micronaut JWT Authentication Guide, I started by adding the needed Maven dependencies and configuration entries:
In Maven pom.xml,
dependencies
section:and in the micronaut-maven-plugin
configuration
section:In my application.yaml file I added this section, (copied from Micronaut Launch generated project):
And finally, I copied the
aot-jar.properties
file containing the configs for JAR packaging AS-IS. With only these changes and nothing else, my very simple integration test failed:The assertion failed because now the status code is 401 (UNAUTHORIZED)
Now, it is pretty obvious that I should expect this since there was no JWT token present.
Questions:
micronaut.security.token.jwt.signatures.secret.generator.secret
property. Which API uses it?@Secured(SecurityRule.IS_AUTHENTICATED)
? I don't need to perform any authentication process (I don't need/want to implement HttpRequestAuthenticationProvider)!Beta Was this translation helpful? Give feedback.
All reactions