![JAR search and dependency download from the Maven repository](/logo.png)
io.imunity.vaadin.auth.sandbox.SandboxAuthnRouterImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unity-server-vaadin-authentication Show documentation
Show all versions of unity-server-vaadin-authentication Show documentation
Vaadin login view and components
/*
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.vaadin.auth.sandbox;
import com.vaadin.flow.server.VaadinService;
import org.apache.logging.log4j.Logger;
import pl.edu.icm.unity.base.utils.Log;
import pl.edu.icm.unity.engine.api.authn.sandbox.SandboxAuthnEvent;
import pl.edu.icm.unity.engine.api.authn.sandbox.SandboxAuthnRouter;
import pl.edu.icm.unity.engine.api.utils.PrototypeComponent;
import java.util.HashSet;
import java.util.Set;
import static java.util.Collections.synchronizedSet;
@PrototypeComponent
class SandboxAuthnRouterImpl implements SandboxAuthnRouter
{
private static final Logger LOG = Log.getLogger(Log.U_SERVER_WEB, SandboxAuthnRouterImpl.class);
private final Set authnListenerList;
SandboxAuthnRouterImpl()
{
authnListenerList = synchronizedSet(new HashSet<>());
}
@Override
public void fireEvent(SandboxAuthnEvent event)
{
LOG.debug("Fire event: {}", event);
synchronized (authnListenerList)
{
for (AuthnResultListener listener: authnListenerList)
listener.onSandboxAuthnResult(event);
}
}
@Override
public void addListener(AuthnResultListener listener)
{
String sessionId = VaadinService.getCurrentRequest().getWrappedSession().getId();
LOG.debug("Adding AuthnResultListener: " + sessionId);
authnListenerList.add(listener);
}
@Override
public void removeListener(AuthnResultListener listener)
{
authnListenerList.remove(listener);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy