mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1364: Extract common SSO resource for IdP redirect.
This commit is contained in:
@@ -120,17 +120,7 @@ public class AuthenticationProviderService implements SSOAuthenticationProviderS
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full URI of the OpenID login endpoint to which a user must
|
||||
* be redirected in order to authenticate and receive an OpenID token.
|
||||
*
|
||||
* @return
|
||||
* The full URI of the OpenID login endpoint, including unique nonce.
|
||||
*
|
||||
* @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())
|
||||
.queryParam("scope", confService.getScope())
|
||||
|
@@ -20,6 +20,7 @@
|
||||
package org.apache.guacamole.auth.openid;
|
||||
|
||||
import org.apache.guacamole.auth.sso.SSOAuthenticationProvider;
|
||||
import org.apache.guacamole.auth.sso.SSOResource;
|
||||
|
||||
/**
|
||||
* Guacamole authentication backend which authenticates users using an
|
||||
@@ -34,7 +35,7 @@ public class OpenIDAuthenticationProvider extends SSOAuthenticationProvider {
|
||||
* against an OpenID service.
|
||||
*/
|
||||
public OpenIDAuthenticationProvider() {
|
||||
super(AuthenticationProviderService.class, OpenIDResource.class,
|
||||
super(AuthenticationProviderService.class, SSOResource.class,
|
||||
new OpenIDAuthenticationProviderModule());
|
||||
}
|
||||
|
||||
|
@@ -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.openid;
|
||||
|
||||
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 OpenID identity
|
||||
* provider.
|
||||
*/
|
||||
public class OpenIDResource implements SSOResource {
|
||||
|
||||
/**
|
||||
* Service for authenticating users using OpenID.
|
||||
*/
|
||||
@Inject
|
||||
private AuthenticationProviderService authService;
|
||||
|
||||
@Override
|
||||
public Response redirectToIdentityProvider() throws GuacamoleException {
|
||||
return Response.seeOther(authService.getLoginURI()).build();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user