com.datahub.authentication.AuthenticationContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datahub-auth-api Show documentation
Show all versions of datahub-auth-api Show documentation
DataHub Auth API for developers to write custom Authentication & Authorization plugins for DataHub
package com.datahub.authentication;
/**
* A static wrapper around a {@link ThreadLocal} instance of {@link Authentication} containing
* information about the currently authenticated actor.
*/
public class AuthenticationContext {
private static final ThreadLocal AUTHENTICATION = new ThreadLocal<>();
public static Authentication getAuthentication() {
return AUTHENTICATION.get();
}
public static void setAuthentication(Authentication authentication) {
AUTHENTICATION.set(authentication);
}
public static void remove() {
AUTHENTICATION.remove();
}
private AuthenticationContext() {}
}