Class AuthRegistry


  • public class AuthRegistry
    extends Object
    So called "guess username" authentication. All preconfigured users can be authenticated.
    • Constructor Detail

      • AuthRegistry

        public AuthRegistry​(Set<String> allowedUsers)
    • Method Detail

      • getAuth

        public Optional<String> getAuth​(long sessionId)
        Get session's auth data if exists.
        Parameters:
        sessionId - session id to get auth info for
        Returns:
        auth info for given session if exists
      • addAuth

        public Optional<String> addAuth​(long sessionId,
                                        String auth)
        Add session with auth t registry.
        Parameters:
        sessionId - session id to add auth info for
        auth - auth info for given session id
        Returns:
        auth info added for session id or empty if auth info is invalid
      • removeAuth

        public String removeAuth​(long sessionId)
        Remove session from registry.
        Parameters:
        sessionId - session id to be removed from registry
        Returns:
        true if session had auth info, false - otherwise