mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-1364: Extract common SSO resource for IdP redirect.
This commit is contained in:
@@ -90,17 +90,7 @@ public class AuthenticationProviderService implements SSOAuthenticationProviderS
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full URI of the CAS login endpoint to which a user must be
|
||||
* redirected in order to authenticate and receive a CAS ticket.
|
||||
*
|
||||
* @return
|
||||
* The full URI of the CAS login endpoint.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If configuration information required for generating the login URI
|
||||
* cannot be read.
|
||||
*/
|
||||
@Override
|
||||
public URI getLoginURI() throws GuacamoleException {
|
||||
return UriBuilder.fromUri(confService.getAuthorizationEndpoint())
|
||||
.path(CAS_LOGIN_URI)
|
||||
|
@@ -20,6 +20,7 @@
|
||||
package org.apache.guacamole.auth.cas;
|
||||
|
||||
import org.apache.guacamole.auth.sso.SSOAuthenticationProvider;
|
||||
import org.apache.guacamole.auth.sso.SSOResource;
|
||||
|
||||
/**
|
||||
* Guacamole authentication backend which authenticates users using an
|
||||
@@ -35,7 +36,7 @@ public class CASAuthenticationProvider extends SSOAuthenticationProvider {
|
||||
*/
|
||||
public CASAuthenticationProvider() {
|
||||
super(AuthenticationProviderService.class,
|
||||
CASResource.class, new CASAuthenticationProviderModule());
|
||||
SSOResource.class, new CASAuthenticationProviderModule());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.guacamole.auth.cas;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.sso.SSOResource;
|
||||
|
||||
/**
|
||||
* REST API resource that automatically redirects users to the CAS login
|
||||
* endpoint.
|
||||
*/
|
||||
public class CASResource implements SSOResource {
|
||||
|
||||
/**
|
||||
* Service for authenticating users using CAS.
|
||||
*/
|
||||
@Inject
|
||||
private AuthenticationProviderService authService;
|
||||
|
||||
@Override
|
||||
public Response redirectToIdentityProvider() throws GuacamoleException {
|
||||
return Response.seeOther(authService.getLoginURI()).build();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user