Class InvocationContext

  • All Implemented Interfaces:
    Serializable

    public class InvocationContext
    extends Object
    implements Serializable
    Stores thread-local information about the current request metadata in thread local variable. The thread-local variable should be set up by the binding authentication code.

    The data stored includes authenticated user's identity and the selected locale.

    Author:
    K. Benedyczak
    See Also:
    Serialized Form
    • Constructor Detail

      • InvocationContext

        public InvocationContext​(IdentityTaV tlsIdentity,
                                 AuthenticationRealm realm,
                                 List<AuthenticationFlow> endpointFlows)
        Parameters:
        tlsIdentity - TLS client-authenticated identity (of X500 type) or null if there is no TLS client connection context or it is not client authenticated.
    • Method Detail

      • hasCurrent

        public static boolean hasCurrent()
      • safeGetRealm

        public static String safeGetRealm()
        Returns:
        current authentication realm's name or null if undefined/unknown.
      • setLoginSession

        public void setLoginSession​(LoginSession loginSession)
      • getLocale

        public Locale getLocale()
        Returns:
        the locale
      • setLocale

        public void setLocale​(Locale locale)
      • getTlsIdentity

        public IdentityTaV getTlsIdentity()
        Returns:
        the TLS authenticated identity if available or null
      • setTlsIdentity

        public void setTlsIdentity​(IdentityTaV tlsIdentity)
        Sets a TLS authenticated identity.
        Parameters:
        tlsIdentity -
      • getCurrentURLUsed

        public String getCurrentURLUsed()
        Returns:
        the current URL which was used to trigger the current processing. Can be null. This is set on best effort basis and is not suitable for authorization or other sensitive operations. Always check if not null.
      • setCurrentURLUsed

        public void setCurrentURLUsed​(String currentURLUsed)