GUACAMOLE-1364: Extract common SSO resource for IdP redirect.

This commit is contained in:
Michael Jumper
2021-12-03 21:12:06 -08:00
parent 0e9860ecf7
commit b6696b9dba
11 changed files with 48 additions and 121 deletions

View File

@@ -95,16 +95,20 @@ public class AuthenticationProviderService implements SSOAuthenticationProviderS
// Redirect to SAML IdP if no SAML identity is associated with the
// Guacamole authentication request
URI authUri = saml.createRequest();
throw new GuacamoleInvalidCredentialsException("Redirecting to SAML IdP.",
new CredentialsInfo(Arrays.asList(new Field[] {
new RedirectField(AUTH_SESSION_QUERY_PARAM, authUri,
new RedirectField(AUTH_SESSION_QUERY_PARAM, getLoginURI(),
new TranslatableMessage("LOGIN.INFO_IDP_REDIRECT_PENDING"))
}))
);
}
@Override
public URI getLoginURI() throws GuacamoleException {
return saml.createRequest();
}
@Override
public void shutdown() {
sessionManager.shutdown();

View File

@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
* endpoint. SAML identity providers will issue an HTTP POST to this endpoint
* asserting the user's identity when the user has successfully authenticated.
*/
public class AssertionConsumerServiceResource implements SSOResource {
public class AssertionConsumerServiceResource extends SSOResource {
/**
* Logger for this class.
@@ -64,11 +64,6 @@ public class AssertionConsumerServiceResource implements SSOResource {
@Inject
private SAMLService saml;
@Override
public Response redirectToIdentityProvider() throws GuacamoleException {
return Response.seeOther(saml.createRequest()).build();
}
/**
* Processes the SAML response submitted by the SAML IdP via an HTTP POST.
* If SSO has been successful, the user is redirected back to Guacamole to