[keycloak-user] Email verification and get admin-client exception entitiy

Benjamin Hansmann [alphaApps] b.hansmann at alphaapps.de
Fri Apr 24 18:07:43 EDT 2015


On Fri, 2015-04-24 at 08:52 +0200, Marek Posolda wrote:
> On 23.4.2015 14:41, Benjamin Hansmann [alphaApps] wrote:
> > Greetings once again. Two more questions:
> >
> > - Is there any way to trigger/send a verification email other than
> > logging in through the web frontend? I created the user through the
> > admin-client and the user will use the direct grant api to login.
> I think it's not possible. That's one of the limitations of Direct Grant 
> API.
> 
> There is admin endpoint to remove required action from the user though, 
> so you as admin can remove the required action for verify email from the 
> user. But user himself needs to use frontend to verify email AFAIK.
> >
> > - When using the admin-client to create a user I want to handle/forward
> > the response body. E.g. when a username already exists a
> > ClientErrorException is thrown which includes a
> > javax.ws.rs.core.Response with Status.CONFLICT. But there does not seem
> > to be an entitiy/body in this Response. When I use the Admin REST API
> > directly I will get: { "errorMessage" : "User exists with
> > same username" }. Is there a way to obtain it when using the
> > admin-client?
> I think you're right. It looks that most of POST methods in admin-client 
> return "void" instead of Response, so there is no possibility to check 
> the details. Feel free to create JIRA for that.
> 
> Btv. If you have Keycloak sources and you want to give it a try, then 
> you can try to change this line: 
> https://github.com/keycloak/keycloak/blob/master/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UsersResource.java#L34 
> to return "Response" instead of void. Then from the Response, you should 
> be able to retrieve entity as ErrorRepresentation with the proper error 
> method attached.
> 

Thanks for the tip, Marek. I gave it a try, but the returned Response is
the same as the one that was included in the ClientErrorException. The
entity is null. Any other suggestions? If not I will use Apache
HttpClient.

Benjamin

> Marek
> >
> > Thanks and best wishes,
> > Benjamin
> 

-- 

[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