Class CredentialsServer

    • Method Detail

      • addAuthenticationToken

        public void addAuthenticationToken​(UUID authenticationToken,
                                           User user)
        Adds an authenticationToken associated with the given user, with the default token validity period
        Parameters:
        authenticationToken - the one-time token
        user - the user credentials associated with the token
      • user

        public User user​(UUID authenticationToken)
                  throws RemoteException
        Specified by:
        user in interface CredentialsService
        Parameters:
        authenticationToken - the token
        Returns:
        the user credentials associated with the given token, null if expired or invalid
        Throws:
        RemoteException - in case of a communication error
      • exit

        public void exit()
        Removes this server from the registry
      • credentialsServer

        public static CredentialsServer credentialsServer​(int port,
                                                          int tokenValidity,
                                                          int cleanupInterval)
                                                   throws AlreadyBoundException,
                                                          RemoteException
        Creates and starts a server on the given port
        Parameters:
        port - the port
        tokenValidity - the number of milliseconds a token is valid
        cleanupInterval - the expired token cleanup interval in milliseconds
        Returns:
        a new CredentialsServer instance
        Throws:
        RemoteException - in case of a communication error
        AlreadyBoundException - if a credential server is already running
      • credentialsServer

        public static CredentialsServer credentialsServer​(int port,
                                                          int registryPort,
                                                          int tokenValidity,
                                                          int cleanupInterval)
                                                   throws AlreadyBoundException,
                                                          RemoteException
        Creates and starts a server on the given port
        Parameters:
        port - the port
        registryPort - the registry port
        tokenValidity - the number of milliseconds a token is valid
        cleanupInterval - the expired token cleanup interval in milliseconds
        Returns:
        a new CredentialsServer instance
        Throws:
        RemoteException - in case of a communication error
        AlreadyBoundException - if a credential server is already running