All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.edu.icm.unity.oauth.as.console.OAuthServiceDefinition Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package pl.edu.icm.unity.oauth.as.console;

import io.imunity.vaadin.auth.services.DefaultServiceDefinition;
import io.imunity.vaadin.auth.services.ServiceDefinition;
import pl.edu.icm.unity.base.endpoint.Endpoint.EndpointState;
import pl.edu.icm.unity.oauth.as.token.OAuthTokenEndpoint;
import pl.edu.icm.unity.oauth.as.webauthz.OAuthAuthzWebEndpoint;

import java.util.List;
import java.util.function.Function;

/**
 * Contains information of {@link OAuthAuthzWebEndpoint} and
 * {@link OAuthTokenEndpoint} configurations and OAuth clients.
 * 
 * @author P.Piernik
 *
 */
class OAuthServiceDefinition implements ServiceDefinition
{
	private DefaultServiceDefinition webAuthzService;
	private DefaultServiceDefinition tokenService;
	private Function> systemClientsSupplier;
	private List selectedClients;
	private String autoGeneratedClientsGroup;

	
	OAuthServiceDefinition(DefaultServiceDefinition oauthWebAuthService, DefaultServiceDefinition tokenService)
	{
		this.webAuthzService = oauthWebAuthService;
		this.tokenService = tokenService;
	}

	@Override
	public String getName()
	{
		return webAuthzService.getName();
	}

	@Override
	public EndpointState getState()
	{
		return webAuthzService.getState();
	}

	@Override
	public String getType()
	{
		return webAuthzService.getType();
	}

	@Override
	public String getBinding()
	{
		return webAuthzService.getBinding();
	}

	public DefaultServiceDefinition getWebAuthzService()
	{
		return webAuthzService;
	}

	public DefaultServiceDefinition getTokenService()
	{
		return tokenService;
	}

	public List getClients(String group)
	{
		return systemClientsSupplier.apply(group);
	}

	public void setClientsSupplier(Function> clientsSupplier)
	{
		this.systemClientsSupplier = clientsSupplier;
	}

	public List getSelectedClients()
	{
		return selectedClients;
	}

	public void setSelectedClients(List serviceClients)
	{
		this.selectedClients = serviceClients;
	}

	public String getAutoGeneratedClientsGroup()
	{
		return autoGeneratedClientsGroup;
	}

	public void setAutoGeneratedClientsGroup(String autoGeneratedGroup)
	{
		this.autoGeneratedClientsGroup = autoGeneratedGroup;
	}
	
	@Override
	public boolean supportsConfigReloadFromFile()
	{
		return webAuthzService.supportsConfigReloadFromFile() && tokenService.supportsConfigReloadFromFile();
	}

	public void setSupportFromConfigReload(boolean supportFromConfigReload)
	{
		webAuthzService.setSupportsConfigReloadFromFile(supportFromConfigReload);
		webAuthzService.setSupportsConfigReloadFromFile(supportFromConfigReload);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy