[keycloak-user] Failed to run the Customer-portal Demo on two machines

Martin Min lingvisa at gmail.com
Wed Aug 3 19:39:08 EDT 2016


Hi, Marek, I changed it to this in view.jsp:

* String logoutUri =
KeycloakUriBuilder.fromUri("/auth").path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)*
*            .queryParam("redirect_uri", "http://localhost:8080
<http://localhost:8080>/customer-portal").build("demo").toString();*


But now when I click the "logout" link, I got this error:

http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri
*=http*%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal

which is slightly different from the earlier error message when I used the
relative url parameter "/customer-portal", as below:

http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri
*=*%2Fcustomer-portal
<http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri=%2Fcustomer-portal>


So just change the 'queryParam(,)' doesn't solve the problem.  Please see
my configuration of URLs.

What needs to be done additionally?


On Mon, Aug 1, 2016 at 10:14 AM, Marek Posolda <mposolda at redhat.com> wrote:

> You also need to change the redirect_uri query param to be absolute URL
> instead of relative URL. As you can see, the value "/customer-portal" is
> just relative URL, so it won't work with 2 separate servers.
>
> Marek
>
>
> On 31/07/16 22:48, Martin Min wrote:
>
> After I changed the relative url "/customer-portal" to its full url, "
> http://localhost:8080/customer-portal", the customer listing and product
> listing functionality works correctly.
>
> However, the remaining problem is, when I click the "log out" link, I
> received this error:
>
>
> http://localhost:8080/auth/realms/demo/protocol/openid-connect/logout?redirect_uri=%2Fcustomer-portal
>
> In view.jsp, the logout code is this:
>
>  String logoutUri =
> KeycloakUriBuilder.fromUri("/auth").path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH)
>             .queryParam("redirect_uri",
> "/customer-portal").build("demo").toString();
>
>
> What could cause this error message?
>
> On Sat, Jul 30, 2016 at 4:58 PM, Martin Min <lingvisa at gmail.com> wrote:
>
>> PLEASE: the title of my email above should be renamed to " Failed to run
>> the Customer-portal Demo on two separate servers, KeyCloak 2.0 and Wildfly
>> 10.0". Not on two machines, but two severs on the same machine. Sorry
>> for the correction.
>>
>> On Sat, Jul 30, 2016 at 4:57 PM, Martin Min < <lingvisa at gmail.com>
>> lingvisa at gmail.com> wrote:
>>
>>> Hi, I can run the preconfigured Customer-portal demo successfully on the
>>> single keycloak-demo-2.0.0.Final distribution by importing the
>>> testrealm.json file to create the realm. Everything works fine.
>>>
>>> And also I can run this simple login/logout demo by following this
>>> instruction to install and setup KeyCloak and Wildfly servers separately:
>>>
>>>
>>> https://keycloak.gitbooks.io/getting-started-tutorials/content/v/2.0/topics/overview.html
>>>
>>>
>>> However, I failed to run the Customer-Portal demo by trying to set up
>>> the KeyClaok server and Wildfly server separately. It always gives me this
>>> message as I clicked the "Customer Listing
>>> <http://localhost:8080/customer-portal/customers/view.jsp>" link:
>>>
>>>
>>> http://localhost:8080/auth/realms/demo/protocol/openid-connect/auth?response_type=code&client_id=customer-portal&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal%2Fcustomers%2Fview.jsp&state=2%2Fe8f347bf-dd8c-4c48-a060-0b01d33476db&login=true
>>>
>>> I did exactly the same thing as I tested in the KeyCloak-demo
>>> distribution by importing the testrealm.json.
>>>
>>> I didn't configure the subsystem section in the Wildfly 10's
>>> standalone.xml, since I believe the "keycloak.json" and "web.xml" in the
>>> application's WEB-INF directory will do the same thing.  I only had this
>>> configured in Wildfly standalone.xml:
>>>
>>> <security-domain name="keycloak">
>>>                     <authentication>
>>>                         <login-module
>>> code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
>>>                     </authentication>
>>>                 </security-domain>
>>>
>>>
>>> What am I missing? Thank you for your help to this working. By the way,
>>> it would be really great to have a full tutorial on how to set up the
>>> customer-portal demo  on two separate KeyCloak and Wildfly servers by
>>> configuring both Json and subsystem file.
>>>
>>> Thank you for help.
>>>
>>>
>>>
>>>
>>>
>>
>
>
> _______________________________________________
> keycloak-user mailing listkeycloak-user at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160803/92d0f96b/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kecloak.png
Type: image/png
Size: 64701 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20160803/92d0f96b/attachment-0001.png 


More information about the keycloak-user mailing list