On 25.4.2015 00:07, Benjamin Hansmann [alphaApps] wrote:
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...
> 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.
That's quite strange. I've just tried our test of admin-client
for
duplicated user and it's possible to retrieve underlying
ErrorRepresentation and error message from ClientErrorException without
issues. See
https://github.com/mposolda/keycloak/blob/master/testsuite/integration/sr...
. So not sure why it's not working for you.
Marek
Benjamin
> Marek
>> Thanks and best wishes,
>> Benjamin