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