Class AbstractPrincipalProvider

    • Field Detail

      • NEGATIVE_ENTRY_KEY

        public static final String NEGATIVE_ENTRY_KEY
        Option name to enable negative cache entries (see JCR-2672)
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractPrincipalProvider

        protected AbstractPrincipalProvider()
        Create a new instance of AbstractPrincipalProvider. Initialization and cache are set up upon init(Properties)
    • Method Detail

      • checkInitialized

        protected void checkInitialized()
        Check if the instance has been closed close().
        Throws:
        IllegalStateException - if this instance was closed.
      • clearCache

        protected void clearCache()
        Clear the principal cache.
      • addToCache

        protected void addToCache​(Principal principal)
        Add an entry to the principal cache.
        Parameters:
        principal - to be cached.
      • providePrincipal

        protected abstract Principal providePrincipal​(String principalName)
        Called if the cache does not contain the principal requested.
        Implementations should return a Principal from their source, if it contains one for the given name or null.
        Parameters:
        principalName - Name of the principal to be returned.
        Returns:
        Principal or null, if non provided for the given name
        See Also:
        getPrincipal(String)
      • getPrincipal

        public Principal getPrincipal​(String principalName)
        Returns the principal with the given name if is known to this provider providePrincipal(String) is called, if no matching entry is present in the cache.
        NOTE: If the cache is enabled to contain negative entries (see NEGATIVE_ENTRY_KEY configuration option), the cache will also store negative matches (as null values) in the principal cache.
        Specified by:
        getPrincipal in interface PrincipalProvider
        Parameters:
        principalName - the name of the principal to retrieve
        Returns:
        return the requested principal or null