Class Login2Delegator
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
-
- com.perforce.p4java.impl.mapbased.server.cmd.Login2Delegator
-
- All Implemented Interfaces:
ILogin2Delegator
public class Login2Delegator extends BaseDelegator implements ILogin2Delegator
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
-
-
Constructor Summary
Constructors Constructor Description Login2Delegator(IOptionsServer server)
Instantiates a new login2 delegator.
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
Login2Delegator
public Login2Delegator(IOptionsServer server)
Instantiates a new login2 delegator.- Parameters:
server
- the server
-
-
Method Detail
-
login2
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> login2(Login2Options opts, java.lang.String user) throws P4JavaException
Description copied from interface:ILogin2Delegator
Generic access method for Login2, to bypass the non-interactive clients methods.- Specified by:
login2
in interfaceILogin2Delegator
- Parameters:
opts
- Login2Optionsuser
- 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
public java.lang.String getLogin2Status() throws P4JavaException
Description copied from interface:ILogin2Delegator
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- Specified by:
getLogin2Status
in interfaceILogin2Delegator
- 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
public java.lang.String getLogin2Status(IUser user) throws P4JavaException
Description copied from interface:ILogin2Delegator
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- Specified by:
getLogin2Status
in interfaceILogin2Delegator
- 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
public java.util.Map<java.lang.String,java.lang.String> login2ListMethods() throws P4JavaException
Description copied from interface:ILogin2Delegator
For non-interactive clients. The first stage 'list-methods'; will report the list of available second factor authentication methods for the given user.- Specified by:
login2ListMethods
in interfaceILogin2Delegator
- 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
public java.lang.String login2InitAuth(java.lang.String method) throws P4JavaException
Description copied from interface:ILogin2Delegator
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.- Specified by:
login2InitAuth
in interfaceILogin2Delegator
- 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
public java.lang.String login2CheckAuth(java.lang.String auth, boolean persist) throws P4JavaException
Description copied from interface:ILogin2Delegator
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.- Specified by:
login2CheckAuth
in interfaceILogin2Delegator
- 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
public java.lang.String login2(IUser user, Login2Options opts) throws P4JavaException
Description copied from interface:ILogin2Delegator
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.- Specified by:
login2
in interfaceILogin2Delegator
- 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.
-
-