KEYCLOAK-4133

Login status iframe endpoint doesn't set encoding
This commit is contained in:
Stian Thorgersen 2016-12-22 08:20:55 +01:00
parent ebd3d522e2
commit 40b5731198

View file

@ -21,17 +21,16 @@ import org.keycloak.common.util.UriUtils;
import org.keycloak.models.ClientModel; import org.keycloak.models.ClientModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.UserSessionModel;
import org.keycloak.protocol.oidc.utils.WebOriginsUtils; import org.keycloak.protocol.oidc.utils.WebOriginsUtils;
import org.keycloak.services.util.CacheControlUtil; import org.keycloak.services.util.CacheControlUtil;
import org.keycloak.services.util.P3PHelper; import org.keycloak.services.util.P3PHelper;
import org.keycloak.utils.MediaType;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import java.io.InputStream; import java.io.InputStream;
@ -55,12 +54,12 @@ public class LoginStatusIframeEndpoint {
} }
@GET @GET
@Produces(MediaType.TEXT_HTML) @Produces(MediaType.TEXT_HTML_UTF_8)
public Response getLoginStatusIframe() { public Response getLoginStatusIframe() {
InputStream resource = getClass().getClassLoader().getResourceAsStream("login-status-iframe.html"); InputStream resource = getClass().getClassLoader().getResourceAsStream("login-status-iframe.html");
if (resource != null) { if (resource != null) {
P3PHelper.addP3PHeader(session); P3PHelper.addP3PHeader(session);
return Response.ok(resource).type(MediaType.TEXT_HTML_TYPE).cacheControl(CacheControlUtil.getDefaultCacheControl()).build(); return Response.ok(resource).cacheControl(CacheControlUtil.getDefaultCacheControl()).build();
} else { } else {
return Response.status(Response.Status.NOT_FOUND).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }