GUACAMOLE-1239: Make identifier comparison case-insensitive.

This commit is contained in:
Virtually Nick
2023-07-18 17:26:40 -04:00
parent 073d1d476e
commit 4d5101574a
43 changed files with 853 additions and 12 deletions

View File

@@ -20,18 +20,28 @@
package org.apache.guacamole.auth.cas;
import com.google.inject.AbstractModule;
import org.apache.guacamole.auth.cas.conf.CASEnvironment;
import org.apache.guacamole.auth.cas.conf.ConfigurationService;
import org.apache.guacamole.auth.cas.ticket.TicketValidationService;
import org.apache.guacamole.environment.Environment;
/**
* Guice module which configures CAS-specific injections.
*/
public class CASAuthenticationProviderModule extends AbstractModule {
/**
* The configuration environment for this server and extension.
*/
private final Environment environment = new CASEnvironment();
@Override
protected void configure() {
bind(ConfigurationService.class);
bind(TicketValidationService.class);
bind(Environment.class).toInstance(environment);
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.conf;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.environment.DelegatingEnvironment;
import org.apache.guacamole.environment.LocalEnvironment;
/**
* An environment for retrieving CAS-related properties from the Guacamole
* configuration.
*/
public class CASEnvironment extends DelegatingEnvironment {
/**
* Create a new instance of the configuration environment for the
* CAS SSO module, pulling the default instance of the LocalEnvironment.
*/
public CASEnvironment() {
super(LocalEnvironment.getInstance());
}
@Override
public boolean getCaseSensitiveUsernames() throws GuacamoleException {
// While most SSO systems do not consider usernames case-sensitive,
// this defaults to the global Guacamole configuration, which defaults
// to true, in order to avoid surprising or breaking environments that
// may rely on this behavior. This can be overridden for the entire
// Guacamole instance or for this extension.
return getProperty(CASGuacamoleProperties.CAS_CASE_SENSITIVE_USERNAMES,
super.getCaseSensitiveUsernames());
}
}

View File

@@ -20,6 +20,7 @@
package org.apache.guacamole.auth.cas.conf;
import org.apache.guacamole.auth.cas.group.GroupFormat;
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
import org.apache.guacamole.properties.EnumGuacamoleProperty;
import org.apache.guacamole.properties.URIGuacamoleProperty;
import org.apache.guacamole.properties.StringGuacamoleProperty;
@@ -117,5 +118,17 @@ public class CASGuacamoleProperties {
public String getName() { return "cas-group-ldap-attribute"; }
};
/**
* A property used to configure whether or not usernames within the CAS SSO
* module should be treated as case-sensitive.
*/
public static final BooleanGuacamoleProperty CAS_CASE_SENSITIVE_USERNAMES =
new BooleanGuacamoleProperty() {
@Override
public String getName() { return "cas-case-sensitive-usernames"; }
};
}