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

com.datahub.authentication.AuthenticationContext Maven / Gradle / Ivy

Go to download

DataHub Auth API for developers to write custom Authentication & Authorization plugins for DataHub

There is a newer version: 0.14.1-12rc1
Show newest version
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() {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy