Class SecurityContext

java.lang.Object
com.sap.cloud.security.token.SecurityContext

public class SecurityContext extends Object
Thread wide Token storage.
  • Method Details

    • getClientCertificate

      @Nullable public static Certificate getClientCertificate()
      Returns the certificate that is saved in thread wide storage.
      Returns:
      the certificate or null if the storage is empty.
    • setClientCertificate

      public static void setClientCertificate(Certificate certificate)
      Saves the certificate thread wide.
      Parameters:
      certificate - certificate to be saved.
    • setToken

      public static void setToken(Token token)
      Saves the validated (!) token thread wide.
      Parameters:
      token - token to be saved.
    • getToken

      @Nullable public static Token getToken()
      Returns the token that is saved in thread wide storage.
      Returns:
      the token or null if the storage is empty.
    • getAccessToken

      @Nullable public static AccessToken getAccessToken()
      Returns the token that is saved in thread wide storage.
      Returns:
      the token or null if the storage is empty or the token does not implement the AccessToken interface.
    • clearToken

      public static void clearToken()
      Clears the current Token from thread wide storage.
    • clear

      public static void clear()
      Clears the current token and certificate from thread wide storage.