<div dir="ltr">Hi Bill,<div><br></div><div>Thanks for the reply. I dunno! I followed the video to the letter.... below is my web.xml for customer-portal. Apologies for noob qn but how do i check application scope?...</div><div><br></div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><web-app xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>"</div><div> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</div><div> xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd</a>"</div><div> version="3.0"></div><div><br></div><div><span class="" style="white-space:pre">        </span><module-name>customer-portal</module-name></div><div><br></div><div> <security-constraint></div><div> <web-resource-collection></div><div> <web-resource-name>Admins</web-resource-name></div><div> <url-pattern>/admin/*</url-pattern></div><div> </web-resource-collection></div><div> <auth-constraint></div><div> <role-name>admin</role-name></div><div> </auth-constraint></div><div> </security-constraint></div><div> <security-constraint></div><div> <web-resource-collection></div><div> <web-resource-name>Customers</web-resource-name></div><div> <url-pattern>/customers/*</url-pattern></div><div> </web-resource-collection></div><div> <auth-constraint></div><div> <role-name>user</role-name></div><div> </auth-constraint></div><div> </security-constraint></div><div><br></div><div> <!--</div><div> <security-constraint></div><div> <web-resource-collection></div><div> <url-pattern>/*</url-pattern></div><div> </web-resource-collection></div><div> <user-data-constraint></div><div> <transport-guarantee>CONFIDENTIAL</transport-guarantee></div><div> </user-data-constraint></div><div> </security-constraint> --></div><div><br></div><div> <login-config></div><div> <auth-method>KEYCLOAK</auth-method></div><div> <realm-name>cryo198</realm-name></div><div> </login-config></div><div><br></div><div> <security-role></div><div> <role-name>admin</role-name></div><div> </security-role></div><div> <security-role></div><div> <role-name>user</role-name></div><div> </security-role></div><div></web-app></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 14, 2015 at 12:27 AM, Bill Burke <span dir="ltr"><<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You don't have constriants set up correctly in web.xml? You don't have<br>
the appropriate scope for the application set up?<br>
<span class=""><br>
On 2/13/2015 4:47 PM, Walter Rice wrote:<br>
> Hi,<br>
><br>
> I am trying to set up the demo as per the youtube videos (#1 and #2). I<br>
> am using keycloak 1.0.5. I have set up per the video (i think), however<br>
> things aren't working as expected.<br>
><br>
> I browse to <a href="http://localhost:8080/customer-portal/" target="_blank">http://localhost:8080/customer-portal/</a> and all is fine. I<br>
> click Customer Listing and I am redirected to login page as expected. I<br>
> enter my name/pw , this is successful and then I am redirected back to<br>
> <a href="http://localhost:8080/customer-portal/customers/view.jsp" target="_blank">http://localhost:8080/customer-portal/customers/view.jsp</a> but the page is<br>
> 'Forbidden' (redirect uri appears ok here?)<br>
><br>
> I am using the 'full' version with bundled wildfly server.<br>
><br>
><br>
><br>
</span>> *customer app:*<br>
<span class="">> keycloak file<br>
><br>
> {<br>
> "realm": "cryo198",<br>
> "realm-public-key":<br>
> "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFnsEHg1o9UMBpMoHqLxYesXgDsTHnv1vF0AgrznxAcLfmYUdjvBNdIXZNfB7I7tG9OMHvX21h9arHdcdg2qqk9adLjHuImg/LhYHVOrosJ/sybohrR/Im+k1fTsw/5p/nwZKOF1DLL4/4SZAY2h19FGCi0ZgIvE80psq98UvCNQIDAQAB",<br>
> "auth-server-url": "<a href="http://localhost:8080/auth" target="_blank">http://localhost:8080/auth</a>",<br>
> "ssl-required": "external",<br>
> "resource": "customer-portal",<br>
> "credentials": {<br>
> "secret": "a0872aa0-113d-435c-a9d6-56cd9b270e22"<br>
> }<br>
> }<br>
><br>
</span>> *web.xml*<br>
<span class="">> <login-config><br>
> <auth-method>KEYCLOAK</auth-method><br>
> <realm-name>cryo198</realm-name><br>
> </login-config><br>
><br>
</span>> *redirect URI:*<br>
> /customer-portal/*<br>
><br>
> *database app:*<br>
<span class="">> {<br>
> "realm": "cryo198",<br>
> "realm-public-key":<br>
> "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFnsEHg1o9UMBpMoHqLxYesXgDsTHnv1vF0AgrznxAcLfmYUdjvBNdIXZNfB7I7tG9OMHvX21h9arHdcdg2qqk9adLjHuImg/LhYHVOrosJ/sybohrR/Im+k1fTsw/5p/nwZKOF1DLL4/4SZAY2h19FGCi0ZgIvE80psq98UvCNQIDAQAB",<br>
> "auth-server-url": "<a href="http://localhost:8080/auth" target="_blank">http://localhost:8080/auth</a>",<br>
> "ssl-required": "NONE",<br>
> "resource": "database",<br>
> "bearer-only": "true"<br>
> }<br>
><br>
><br>
><br>
</span>> *web.xml*<br>
<span class="">> <login-config><br>
> <auth-method>KEYCLOAK</auth-method><br>
> <realm-name>cryo198</realm-name><br>
> </login-config><br>
><br>
</span>> *redirect URI:*<br>
<span class="">> n./a ..set as bearer only<br>
><br>
</span>> *deployed apps:*<br>
<span class="">> $<br>
> /c/tools/keycloak-appliance-dist-all-1.0.5.Final/keycloak-appliance-dist-all-1.0.5.Final/keycloak/bin/jboss-cli.sh<br>
> -c --command="deploy -l"<br>
> NAME RUNTIME-NAME ENABLED STATUS<br>
> admin-access.war admin-access.war true OK<br>
> angular-product.war angular-product.war true OK<br>
> auth-server.war auth-server.war true OK<br>
> customer-portal-js.war customer-portal-js.war true OK<br>
> customer-portal.war customer-portal.war true OK<br>
> database.war database.war true OK<br>
> product-portal.war product-portal.war true OK<br>
><br>
><br>
><br>
><br>
><br>
><br>
</span>> *Log:*<br>
<div><div class="h5">> 2015-02-13 21:22:29,665 DEBUG<br>
> [org.keycloak.adapters.PreAuthActionsHandler] (default task-41)<br>
> adminRequest <a href="http://localhost:8080/customer-portal/custo" target="_blank">http://localhost:8080/customer-portal/custo</a><br>
> mers/view.jsp<br>
> 2015-02-13 21:22:29,667 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-41) --><br>
> authenticate()<br>
> 2015-02-13 21:22:29,668 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-41) try bearer<br>
> 2015-02-13 21:22:29,669 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-41) try oauth<br>
> 2015-02-13 21:22:29,669 DEBUG<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-41) session<br>
> was null, returning null<br>
> 2015-02-13 21:22:29,670 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-41)<br>
> there was no code<br>
> 2015-02-13 21:22:29,670 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-41)<br>
> redirecting to auth server<br>
> 2015-02-13 21:22:29,671 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-41)<br>
> callback uri: <a href="http://localhost:8080/customer-portal/" target="_blank">http://localhost:8080/customer-portal/</a><br>
> customers/view.jsp<br>
> 2015-02-13 21:22:29,672 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-41)<br>
> Sending redirect to login page: <a href="http://localhost:808" target="_blank">http://localhost:808</a><br>
> 0/auth/realms/cryo198/tokens/login?client_id=customer-portal&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcustomer-portal%2Fcustomers%2Fview.jsp&state<br>
> =2%2F8185a8ea-5a38-4a91-b990-1b32ccabb2e8&login=true<br>
> 2015-02-13 21:22:29,701 DEBUG<br>
> [org.keycloak.services.resources.TokenService] (default task-42)<br>
> replacing relative valid redirect with: <a href="http://localhos" target="_blank">http://localhos</a><br>
> t:8080/customer-portal/*<br>
> 2015-02-13 21:22:29,702 DEBUG<br>
> [org.keycloak.services.managers.AuthenticationManager] (default task-42)<br>
> Could not find cookie: KEYCLOAK_IDENTITY<br>
> 2015-02-13 21:22:46,300 DEBUG<br>
> [org.keycloak.services.resources.TokenService] (default task-43)<br>
> replacing relative valid redirect with: <a href="http://localhos" target="_blank">http://localhos</a><br>
> t:8080/customer-portal/*<br>
> 2015-02-13 21:22:46,301 DEBUG<br>
> [org.keycloak.services.managers.AuthenticationManager] (default task-43)<br>
> validating password for user: walt<br>
> 2015-02-13 21:22:46,306 DEBUG<br>
> [org.keycloak.services.managers.AuthenticationManager] (default task-43)<br>
> Expiring remember me cookie<br>
> 2015-02-13 21:22:46,307 DEBUG<br>
> [org.keycloak.services.managers.AuthenticationManager] (default task-43)<br>
> Expiring cookie: KEYCLOAK_REMEMBER_ME path: /au<br>
> th/realms/cryo198<br>
> 2015-02-13 21:22:46,308 DEBUG<br>
> [org.keycloak.services.resources.flows.OAuthFlows] (default task-43)<br>
> processAccessCode: isResource: true<br>
> 2015-02-13 21:22:46,308 DEBUG<br>
> [org.keycloak.services.resources.flows.OAuthFlows] (default task-43)<br>
> processAccessCode: go to oauth page?: false<br>
> 2015-02-13 21:22:46,329 DEBUG<br>
> [org.keycloak.services.resources.flows.OAuthFlows] (default task-43)<br>
> redirectAccessCode: state: 2/8185a8ea-5a38-4a91-b99<br>
> 0-1b32ccabb2e8<br>
> 2015-02-13 21:22:46,340 DEBUG<br>
> [org.keycloak.services.managers.AuthenticationManager] (default task-43)<br>
> Create login cookie - name: KEYCLOAK_IDENTITY,<br>
> path: /auth/realms/cryo198, max-age: -1<br>
> 2015-02-13 21:22:46,387 DEBUG<br>
> [org.keycloak.adapters.PreAuthActionsHandler] (default task-44)<br>
> adminRequest <a href="http://localhost:8080/customer-portal/custo" target="_blank">http://localhost:8080/customer-portal/custo</a><br>
> mers/view.jsp?code=zf9VUvG6-QkAWtF8xDFcJfnBnrY.OTY1YjllMzMtZDdlNS00YWQwLWEwMzgtZjIzMTJhODZjMTIx&state=2%2F8185a8ea-5a38-4a91-b990-1b32ccabb2e8<br>
> 2015-02-13 21:22:46,388 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-44) --><br>
> authenticate()<br>
> 2015-02-13 21:22:46,389 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-44) try bearer<br>
> 2015-02-13 21:22:46,389 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-44) try oauth<br>
> 2015-02-13 21:22:46,389 DEBUG<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-44) session<br>
> was null, returning null<br>
> 2015-02-13 21:22:46,390 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-44)<br>
> there was a code, resolving<br>
> 2015-02-13 21:22:46,390 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-44)<br>
> checking state cookie for after code<br>
> 2015-02-13 21:22:46,390 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-44) **<br>
> reseting application state cookie<br>
> 2015-02-13 21:22:46,477 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-44)<br>
> Token Verification succeeded!<br>
> 2015-02-13 21:22:46,478 DEBUG<br>
> [org.keycloak.adapters.OAuthRequestAuthenticator] (default task-44)<br>
> successful authenticated<br>
> 2015-02-13 21:22:46,478 TRACE<br>
> [org.keycloak.adapters.RefreshableKeycloakSecurityContext] (default<br>
> task-44) checking whether to refresh.<br>
> 2015-02-13 21:22:46,478 TRACE<br>
> [org.keycloak.adapters.undertow.KeycloakUndertowAccount] (default<br>
> task-44) use realm role mappings<br>
> 2015-02-13 21:22:46,479 DEBUG<br>
> [org.keycloak.adapters.wildfly.WildflyRequestAuthenticator] (default<br>
> task-44) propagate security context to wildfly<br>
> 2015-02-13 21:22:46,481 TRACE<br>
> [org.keycloak.adapters.RefreshableKeycloakSecurityContext] (default<br>
> task-44) checking whether to refresh.<br>
> 2015-02-13 21:22:46,484 DEBUG<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-44) AUTHENTICATED<br>
> 2015-02-13 21:22:46,502 DEBUG<br>
> [org.keycloak.adapters.PreAuthActionsHandler] (default task-46)<br>
> adminRequest <a href="http://localhost:8080/customer-portal/custo" target="_blank">http://localhost:8080/customer-portal/custo</a><br>
> mers/view.jsp<br>
> 2015-02-13 21:22:46,505 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-46) --><br>
> authenticate()<br>
> 2015-02-13 21:22:46,506 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-46) try bearer<br>
> 2015-02-13 21:22:46,506 TRACE<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-46) try oauth<br>
> 2015-02-13 21:22:46,507 DEBUG<br>
> [org.keycloak.adapters.undertow.KeycloakUndertowAccount] (default<br>
> task-46) session is active<br>
> 2015-02-13 21:22:46,508 DEBUG<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-46) Cached<br>
> account found<br>
> 2015-02-13 21:22:46,508 DEBUG<br>
> [org.keycloak.adapters.wildfly.WildflyRequestAuthenticator] (default<br>
> task-46) propagate security context to wildfly<br>
> 2015-02-13 21:22:46,509 DEBUG<br>
> [org.keycloak.adapters.RequestAuthenticator] (default task-46)<br>
> AUTHENTICATED: was cached<br>
> 2015-02-13 21:22:46,510 DEBUG<br>
> [org.keycloak.adapters.AuthenticatedActionsHandler] (default task-46)<br>
> AuthenticatedActionsValve.invoke <a href="http://localhost" target="_blank">http://localhost</a>:<br>
> 8080/customer-portal/customers/view.jsp<br>
><br>
><br>
> Many thanks<br>
> W<br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> keycloak-user mailing list<br>
> <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Bill Burke<br>
JBoss, a division of Red Hat<br>
<a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
</font></span></blockquote></div><br></div>