<div dir="ltr">JIRA created: <a href="https://issues.jboss.org/browse/KEYCLOAK-746">https://issues.jboss.org/browse/KEYCLOAK-746</a><div><br></div><div>Just out of curiosity, how would that be fixed? A simple test on request.getHttpMethod? or with something a little more complex?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 9, 2014 at 10:33 AM, Stian Thorgersen <span dir="ltr">&lt;<a href="mailto:stian@redhat.com" target="_blank">stian@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">That&#39;s a bug, it should only be checking that if it&#39;s a post. Can you create a jira please?<br>
<span class="im HOEnZb"><br>
----- Original Message -----<br>
&gt; From: &quot;Rodrigo Sasaki&quot; &lt;<a href="mailto:rodrigopsasaki@gmail.com">rodrigopsasaki@gmail.com</a>&gt;<br>
</span><div class="HOEnZb"><div class="h5">&gt; To: &quot;Stian Thorgersen&quot; &lt;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; Sent: Thursday, 9 October, 2014 3:27:12 PM<br>
&gt; Subject: Re: [keycloak-user] Link to Account Page<br>
&gt;<br>
&gt; When I invoke that URL it calles the init() method, inside<br>
&gt; AccountService.java and inside that method there is this verification:<br>
&gt;<br>
&gt; String referrer = headers.getRequestHeaders().getFirst(&quot;Referer&quot;);<br>
&gt; if (referrer != null &amp;&amp;<br>
&gt; !requestOrigin.equals(UriUtils.getOrigin(referrer))) {<br>
&gt;     throw new ForbiddenException();<br>
&gt; }<br>
&gt;<br>
&gt; the referrer is from our server, but the requestOrigin points to the<br>
&gt; keycloak server, so they never match<br>
&gt;<br>
&gt; On Thu, Oct 9, 2014 at 5:45 AM, Stian Thorgersen &lt;<a href="mailto:stian@redhat.com">stian@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; You can link to the account page with the following link:<br>
&gt; &gt;<br>
&gt; &gt;   https://&lt;KEYCLOAK SERVER&gt;/auth/realms/&lt;REALM NAME&gt;/account<br>
&gt; &gt;<br>
&gt; &gt; You can also have an option to get a link back to your application by<br>
&gt; &gt; adding either referrer or referrer_uri query param:<br>
&gt; &gt;<br>
&gt; &gt; * referrer - your applications id (this requires &quot;Default Redirect URL&quot; to<br>
&gt; &gt; be set for your application)<br>
&gt; &gt; * referrer_uri - the uri to return to (this requires referrer_uri to be a<br>
&gt; &gt; valid redirect uri for your application)<br>
&gt; &gt;<br>
&gt; &gt; We do this in the admin console, so you can look at how it works there.<br>
&gt; &gt; Login to the admin console, click on your username in the top-right corner,<br>
&gt; &gt; and click on &#39;Manage account&#39;. In the account management there&#39;s now in the<br>
&gt; &gt; top-right corner &#39;Back to security-admin-console&#39;. If you try edit the url<br>
&gt; &gt; to remove &#39;?referrer=security-admin-console&#39; you&#39;ll see this link is no<br>
&gt; &gt; longer there.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; I&#39;ve got no idea what validation you&#39;re talking about that that checks the<br>
&gt; &gt; referrer is the same as the server. Maybe it&#39;s the fact that for an update<br>
&gt; &gt; (post) we only allow a post originating from the Keycloak server? That<br>
&gt; &gt; doesn&#39;t stop you from linking to the account page, but it stops you from<br>
&gt; &gt; posting to it.<br>
&gt; &gt;<br>
&gt; &gt; ----- Original Message -----<br>
&gt; &gt; &gt; From: &quot;Rodrigo Sasaki&quot; &lt;<a href="mailto:rodrigopsasaki@gmail.com">rodrigopsasaki@gmail.com</a>&gt;<br>
&gt; &gt; &gt; To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; &gt; &gt; Sent: Wednesday, 8 October, 2014 11:29:17 PM<br>
&gt; &gt; &gt; Subject: [keycloak-user] Link to Account Page<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Hello,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I am trying to create a link on our application to go directly to<br>
&gt; &gt; Keycloak&#39;s<br>
&gt; &gt; &gt; Account Page, so the user can alter his information, but it doesn&#39;t work.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I saw that there is a validation that assures that the referrer is the<br>
&gt; &gt; same<br>
&gt; &gt; &gt; as the server, for example: I can only access the account app inside my<br>
&gt; &gt; &gt; localhost:8080 if the referrer is also in localhost:8080.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Is it supposed to be like this? Is there a way for me to create a<br>
&gt; &gt; hyperlink<br>
&gt; &gt; &gt; from my application directly to Keycloak&#39;s Account Page? Given that my<br>
&gt; &gt; own<br>
&gt; &gt; &gt; application is secured by Keycloak, I think it should be possible.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Is this the correct behavior?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thanks again!<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; --<br>
&gt; &gt; &gt; Rodrigo Sasaki<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; keycloak-user mailing list<br>
&gt; &gt; &gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Rodrigo Sasaki<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><font face="Times New Roman">Rodrigo Sasaki</font><div></div></div>
</div>