GUACAMOLE-1629: Add configuration properties and associated translations.

This commit is contained in:
James Muehlner
2022-06-28 20:55:19 +00:00
parent 46661eed74
commit f7d90a641e
5 changed files with 134 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
/*
* 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.vault.conf;
import java.util.Collection;
import org.apache.guacamole.form.Form;
/**
* A service that exposes attributes for the admin UI, specific to the vault
* implementation. Any vault implementation will need to expose the attributes
* necessary for that implementation.
*/
public interface VaultAttributeService {
/**
* Return all connection group attributes to be exposed through the admin UI.
*
* @return
* All connection group attributes to be exposed through the admin UI.
*/
public Collection<Form> getConnectionGroupAttributes();
}

View File

@@ -22,12 +22,15 @@ package org.apache.guacamole.vault.user;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleServerException;
import org.apache.guacamole.form.Form;
import org.apache.guacamole.net.auth.Connection;
import org.apache.guacamole.net.auth.ConnectionGroup;
import org.apache.guacamole.net.auth.TokenInjectingUserContext;
@@ -35,6 +38,7 @@ import org.apache.guacamole.net.auth.UserContext;
import org.apache.guacamole.protocol.GuacamoleConfiguration;
import org.apache.guacamole.token.GuacamoleTokenUndefinedException;
import org.apache.guacamole.token.TokenFilter;
import org.apache.guacamole.vault.conf.VaultAttributeService;
import org.apache.guacamole.vault.conf.VaultConfigurationService;
import org.apache.guacamole.vault.secret.VaultSecretService;
import org.slf4j.Logger;
@@ -121,6 +125,13 @@ public class VaultUserContext extends TokenInjectingUserContext {
@Inject
private VaultSecretService secretService;
/**
* Service for retrieving any custom attributes defined for the
* current vault implementation.
*/
@Inject
private VaultAttributeService attributeService;
/**
* Creates a new VaultUserContext which automatically injects tokens
* containing values of secrets retrieved from a vault. The given
@@ -403,4 +414,9 @@ public class VaultUserContext extends TokenInjectingUserContext {
}
@Override
public Collection<Form> getConnectionGroupAttributes() {
return attributeService.getConnectionGroupAttributes();
}
}