[keycloak-user] Get message for ModelException in admin-client
Benjamin Hansmann [alphaApps]
b.hansmann at alphaapps.de
Tue May 12 20:01:43 EDT 2015
On Tue, 2015-05-12 at 21:54 +0000, Leonardo Loch Zanivan wrote:
> I've created a generic exception mapper for REST API but also
> specialized for ModelException to return correct internationalized
> message.
>
Thanks for implementing this, Leonardo.
> JIRA: https://issues.jboss.org/browse/KEYCLOAK-1306
> PR: https://github.com/keycloak/keycloak/pull/1251
>
> I'll also need i18n in the admin console, +1 JIRA
> (https://issues.jboss.org/browse/KEYCLOAK-1308).
>
>
> On Sat, May 9, 2015 at 5:40 PM Leonardo Loch Zanivan
> <leonardo.zanivan at gmail.com> wrote:
>
> I'll work on that next week..
>
> Thanks!
>
>
> On Wed, May 6, 2015 at 3:37 PM Marek Posolda
> <mposolda at redhat.com> wrote:
> +1 for JIRA. Also feel free to send PR as you already
> nail it down and you already send some PRs :-)
>
> By the way, Thanks for them.
>
> It seems that generally we should improve on handling
> errors from admin REST endpoints. Ideally you can
> handle the error response similarly like it's done
> here:
> https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java#L771 . Then on admin-client side, you can catch ClientErrorException and see the error message for example like done here: https://github.com/keycloak/keycloak/blob/master/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java#L49
>
> Thanks,
> Marek
>
>
> On 6.5.2015 19:31, Leonardo Loch Zanivan wrote:
>
> > Unfortunatelly I think it's not possible right now.
> >
> > Admin client uses Admin REST API, which isn't
> > handling errors correctly.
> >
> > If you try to reset a password using Admin interface
> > you will get a generic error 500 saying "Failed to
> > reset user password".
> >
> > In the server the stacktrace shows:
> > Caused by:
> > org.jboss.resteasy.spi.UnhandledException:
> > org.keycloak.models.ModelException:
> > invalidPasswordMinLengthMessage
> >
> > We could fill a JIRA to handle ModelException using
> > JAX-RS exception handlers, so the response will have
> > the correct error and we could show a better error
> > message.
> >
> > On Wed, May 6, 2015 at 2:10 PM Benjamin Hansmann
> > [alphaApps] <b.hansmann at alphaapps.de> wrote:
> > Is one able to get an error message from the
> > resetPassword method of
> > admin-client if it somehow failed to reset
> > the password, like when the
> > password is too short or does not comply
> > with the password policy?
> >
> > It throws an InternalServerErrorException in
> > that case. On the server
> > side there seems to be a ModelException:
> > invalidPasswordMinLengthMessage. That
> > information is lost...
> >
> >
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
> >
> >
> > _______________________________________________
> > keycloak-user mailing list
> > keycloak-user at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
--
[alphaApps] mobile development
Benjamin Hansmann
Nosthoffenstraße 46
D-40589 Düsseldorf
Germany
Mobile: +49 (0) 177 249 47 47
Email: b.hansmann at alphaapps.de
More information about the keycloak-user
mailing list