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 the AuthenticationException detail message #17

Open
ibmsoft opened this issue Sep 16, 2020 · 2 comments
Open

how to get the AuthenticationException detail message #17

ibmsoft opened this issue Sep 16, 2020 · 2 comments

Comments

@ibmsoft
Copy link

ibmsoft commented Sep 16, 2020

image

i want to get AuthenticationException ex
that throw in my custom realms,but can not get the message in my realms throws

@ibmsoft ibmsoft changed the title how to get the detail message how to get the AuthenticationException detail message Sep 16, 2020
@pmcneil
Copy link
Member

pmcneil commented Sep 16, 2020

Firstly Interceptors do not throw exceptions, only annotations do.

The ShiroGrailsExceptionResolver catches exceptions and redirects to a 401 or 403 as mentioned here https://github.com/nerdErg/grails-shiro/blob/master/docs/Guide.adoc#redirecting-unauthenticated-and-unauthorized

You can stop grails-shiro from handling exceptions by setting "handleExceptions" to false see https://github.com/nerdErg/grails-shiro/blob/master/docs/Guide.adoc#handleexceptions
(set security.shiro.handleExceptions: false )

OR you can override the ShiroGrailsExceptionResolver with your own.

Note if you just wish to log the message then perhaps do that from your Realm. It is rarely a good idea to pass on explicit information about what went wrong logging in to the user as that risks leaking information to an attacker.

@pmcneil
Copy link
Member

pmcneil commented Sep 16, 2020

Note possibly more usable version of docs at https://nerderg.com/docs/shiro/guide.html

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