KEYCLOAK-3671

This commit is contained in:
Bill Burke 2016-10-06 14:56:02 -04:00
parent 74325fe133
commit fbb65fa072
5 changed files with 5 additions and 5 deletions

View file

@ -64,7 +64,7 @@ public class IdentityProviderAuthenticator implements Authenticator {
for (IdentityProviderModel identityProvider : identityProviders) { for (IdentityProviderModel identityProvider : identityProviders) {
if (identityProvider.isEnabled() && providerId.equals(identityProvider.getAlias())) { if (identityProvider.isEnabled() && providerId.equals(identityProvider.getAlias())) {
String accessCode = new ClientSessionCode(context.getRealm(), context.getClientSession()).getCode(); String accessCode = new ClientSessionCode(context.getRealm(), context.getClientSession()).getCode();
Response response = Response.temporaryRedirect( Response response = Response.status(302).location(
Urls.identityProviderAuthnRequest(context.getUriInfo().getBaseUri(), providerId, context.getRealm().getName(), accessCode)) Urls.identityProviderAuthnRequest(context.getUriInfo().getBaseUri(), providerId, context.getRealm().getName(), accessCode))
.build(); .build();

View file

@ -91,7 +91,7 @@ public abstract class AbstractOAuth2IdentityProvider<C extends OAuth2IdentityPro
try { try {
URI authorizationUrl = createAuthorizationUrl(request).build(); URI authorizationUrl = createAuthorizationUrl(request).build();
return Response.temporaryRedirect(authorizationUrl).build(); return Response.status(302).location(authorizationUrl).build();
} catch (Exception e) { } catch (Exception e) {
throw new IdentityBrokerException("Could not create authentication request.", e); throw new IdentityBrokerException("Could not create authentication request.", e);
} }

View file

@ -719,7 +719,7 @@ public class AccountService extends AbstractSecuredLocalService {
clientSession.setRedirectUri(redirectUri); clientSession.setRedirectUri(redirectUri);
clientSession.setNote(OIDCLoginProtocol.STATE_PARAM, UUID.randomUUID().toString()); clientSession.setNote(OIDCLoginProtocol.STATE_PARAM, UUID.randomUUID().toString());
return Response.temporaryRedirect( return Response.status(302).location(
Urls.identityProviderAuthnRequest(this.uriInfo.getBaseUri(), providerId, realm.getName(), clientSessionCode.getCode())) Urls.identityProviderAuthnRequest(this.uriInfo.getBaseUri(), providerId, realm.getName(), clientSessionCode.getCode()))
.build(); .build();
} catch (Exception spe) { } catch (Exception spe) {

View file

@ -163,7 +163,7 @@ public class RealmsResource {
targetUri = KeycloakUriBuilder.fromUri(ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), client.getRootUrl(), client.getBaseUrl())).build(); targetUri = KeycloakUriBuilder.fromUri(ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), client.getRootUrl(), client.getBaseUrl())).build();
} }
return Response.temporaryRedirect(targetUri).build(); return Response.status(302).location(targetUri).build();
} }
@Path("{realm}/login-actions") @Path("{realm}/login-actions")

View file

@ -82,7 +82,7 @@ public class TwitterIdentityProvider extends AbstractIdentityProvider<OAuth2Iden
URI authenticationUrl = URI.create(requestToken.getAuthenticationURL()); URI authenticationUrl = URI.create(requestToken.getAuthenticationURL());
return Response.temporaryRedirect(authenticationUrl).build(); return Response.status(302).location(authenticationUrl).build();
} catch (Exception e) { } catch (Exception e) {
throw new IdentityBrokerException("Could send authentication request to twitter.", e); throw new IdentityBrokerException("Could send authentication request to twitter.", e);
} }