Interface ILogin2Delegator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getLogin2Status()
      Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command.
      java.lang.String getLogin2Status​(IUser user)
      Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command.
      java.lang.String login2​(IUser user, Login2Options opts)
      Validate user second factor authentication.
      java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> login2​(Login2Options opts, java.lang.String user)
      Generic access method for Login2, to bypass the non-interactive clients methods.
      java.lang.String login2CheckAuth​(java.lang.String auth, boolean persist)
      For non-interactive clients.
      java.lang.String login2InitAuth​(java.lang.String method)
      For non-interactive clients.
      java.util.Map<java.lang.String,​java.lang.String> login2ListMethods()
      For non-interactive clients.
    • Method Detail

      • login2

        java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> login2​(Login2Options opts,
                                                                                      java.lang.String user)
                                                                               throws P4JavaException
        Generic access method for Login2, to bypass the non-interactive clients methods.
        Parameters:
        opts - Login2Options
        user - non-null Perforce user; login request is for this specified user, requires 'super' permission.
        Returns:
        A list of result map objects
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • getLogin2Status

        java.lang.String getLogin2Status()
                                  throws P4JavaException
        Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command. The resulting string should be interpreted by the caller, but is typically something like: User bob1 on host 127.0.0.1: validated
        Returns:
        non-null, but possibly-empty. Interpretation of this string is up to the caller.
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • getLogin2Status

        java.lang.String getLogin2Status​(IUser user)
                                  throws P4JavaException
        Return a string indicating the current 2fa login status; corresponds to the 'p4 login2 -s' command. The resulting string should be interpreted by the caller, but is typically something like: User bob1 on host 127.0.0.1: validated
        Parameters:
        user - Specifying a username requires 'super' access, which is granted by 'p4 protect'.
        Returns:
        non-null, but possibly-empty. Interpretation of this string is up to the caller.
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • login2ListMethods

        java.util.Map<java.lang.String,​java.lang.String> login2ListMethods()
                                                                          throws P4JavaException
        For non-interactive clients. The first stage 'list-methods'; will report the list of available second factor authentication methods for the given user.
        Returns:
        A key value pair of second factor method IDs and their descriptions
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • login2InitAuth

        java.lang.String login2InitAuth​(java.lang.String method)
                                 throws P4JavaException
        For non-interactive clients. The second stage 'init-auth' must specify a method (-m flag) to initiate the authentication with the second factor authentication provider.
        Parameters:
        method - Second factor authentication method, chosen from the list provided by 'list-methods'.
        Returns:
        Prompt from the second factor authentication method (e.g. a key, password, answer, etc...)
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • login2CheckAuth

        java.lang.String login2CheckAuth​(java.lang.String auth,
                                         boolean persist)
                                  throws P4JavaException
        For non-interactive clients. The final step is 'check-auth', which will either prompt for a OTP or request the authorization status from the second factor authentication provider, depending on the type of authentication method selected. The -p flag may be provided at the 'init-auth' stage. If a host and/or user is being specified, the appropriate arguments must be provided at each stage.
        Parameters:
        auth - The answer to the second factor authorization prompt.
        persist - Persist the second factor authorization even after the user's ticket has expired.
        Returns:
        Verification message from second factor authorization.
        Throws:
        P4JavaException - if any errors occur during the processing of this command.
      • login2

        java.lang.String login2​(IUser user,
                                Login2Options opts)
                         throws P4JavaException
        Validate user second factor authentication. Specifying a username as an argument to 'p4 login2' requires 'super' access, which is granted by 'p4 protect'. In this case, 'p4 login2' skips the second factor authentication process and immediately marks the user as validated for the current host.
        Parameters:
        user - Specifying a username requires 'super' access, which is granted by 'p4 protect'.
        opts - Login2Options
        Returns:
        Verification message from second factor authorization.
        Throws:
        P4JavaException - if any errors occur during the processing of this command.