io.imunity.upman.console.UpmanServiceEditor Maven / Gradle / Ivy
/*
* Copyright (c) 2019 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.upman.console;
import java.util.List;
import java.util.Set;
import io.imunity.upman.UpManEndpointFactory;
import io.imunity.vaadin.auth.services.DefaultServiceDefinition;
import io.imunity.vaadin.auth.services.ServiceDefinition;
import io.imunity.vaadin.auth.services.ServiceEditor;
import io.imunity.vaadin.auth.services.ServiceEditorComponent;
import io.imunity.vaadin.auth.services.tabs.WebServiceAuthenticationTab;
import io.imunity.vaadin.endpoint.common.forms.VaadinLogoImageLoader;
import pl.edu.icm.unity.base.authn.AuthenticationFlowDefinition;
import pl.edu.icm.unity.base.message.MessageSource;
import pl.edu.icm.unity.engine.api.authn.AuthenticatorInfo;
import pl.edu.icm.unity.engine.api.authn.AuthenticatorSupportService;
import pl.edu.icm.unity.engine.api.config.UnityServerConfiguration;
import pl.edu.icm.unity.engine.api.files.FileStorageService;
import io.imunity.vaadin.endpoint.common.exceptions.FormValidationException;
class UpmanServiceEditor implements ServiceEditor
{
private final MessageSource msg;
private final List allRealms;
private final List flows;
private final List authenticators;
private final List upManServices;
private final List registrationForms;
private final VaadinLogoImageLoader imageAccessService;
private final FileStorageService fileStorageService;
private final UnityServerConfiguration serverConfig;
private final AuthenticatorSupportService authenticatorSupportService;
private final List usedEndpointsPaths;
private final List usedNames;
private final Set serverContextPaths;
private UpmanEditorComponent editor;
UpmanServiceEditor(MessageSource msg, VaadinLogoImageLoader imageAccessService,
FileStorageService fileStorageService, UnityServerConfiguration serverConfig,
List allRealms, List flows,
List authenticators, List upManServices,
List registrationForms, List usedPaths, List usedNames, Set serverContextPaths,
AuthenticatorSupportService authenticatorSupportService)
{
this.msg = msg;
this.allRealms = allRealms;
this.authenticators = authenticators;
this.flows = flows;
this.upManServices = upManServices;
this.registrationForms = registrationForms;
this.fileStorageService = fileStorageService;
this.serverConfig = serverConfig;
this.authenticatorSupportService = authenticatorSupportService;
this.usedEndpointsPaths = usedPaths;
this.usedNames = usedNames;
this.serverContextPaths = serverContextPaths;
this.imageAccessService = imageAccessService;
}
@Override
public ServiceEditorComponent getEditor(ServiceDefinition endpoint)
{
UpmanServiceEditorGeneralTab homeServiceEditorGeneralTab = new UpmanServiceEditorGeneralTab(msg,
UpManEndpointFactory.TYPE, usedEndpointsPaths, usedNames, serverContextPaths, upManServices);
WebServiceAuthenticationTab authenticationTab = new WebServiceAuthenticationTab(msg,
serverConfig, authenticatorSupportService, flows, authenticators, allRealms,
registrationForms, UpManEndpointFactory.TYPE.getSupportedBinding());
editor = new UpmanEditorComponent(msg, homeServiceEditorGeneralTab, authenticationTab,
imageAccessService, fileStorageService, serverConfig,
(DefaultServiceDefinition) endpoint);
return editor;
}
@Override
public ServiceDefinition getEndpointDefiniton() throws FormValidationException
{
return editor.getServiceDefiniton();
}
}