KEYCLOAK-746 Allow linking to account from external provider

This commit is contained in:
Stian Thorgersen 2014-10-10 10:15:23 +02:00
parent eac1fb23cf
commit 4d401224de

View file

@ -70,6 +70,7 @@ import org.keycloak.util.UriUtils;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.OPTIONS; import javax.ws.rs.OPTIONS;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -181,9 +182,11 @@ public class AccountService {
throw new ForbiddenException(); throw new ForbiddenException();
} }
String referrer = headers.getRequestHeaders().getFirst("Referer"); if (!request.getHttpMethod().equals("GET")) {
if (referrer != null && !requestOrigin.equals(UriUtils.getOrigin(referrer))) { String referrer = headers.getRequestHeaders().getFirst("Referer");
throw new ForbiddenException(); if (referrer != null && !requestOrigin.equals(UriUtils.getOrigin(referrer))) {
throw new ForbiddenException();
}
} }
} }