Class EdCli
- java.lang.Object
-
- edu.vt.middleware.ldap.ed.executables.EdCli
-
public class EdCli extends Object
Provides a command line interface to ED operations.- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTHN_OPTION
Authenticate option flag.static String
AUTHZ_OPTION
Authorize option flag.static String
CREDENTIAL_OPTION
Credential option flag.static String
ENV_OPTION
Directory environment option.static String
HELP_LONG_OPTION
Help long option flag.static String
HELP_OPTION
Help option flag.static String
MFA_OPTION
Use MFA option flag.static String
MFA_VALUE_OPTION
Use MFA value option flag.static String
QUERY_OPTION
Query option flag.static String
SHOW_AFFILIATIONS_OPTION
Show affiliations option flag.static String
SHOW_GROUP_MEMBERSHIP_OPTION
Show group membership option flag.static String
TYPE_OPTION
Directory type option.static String
USER_OPTION
User option flag.
-
Constructor Summary
Constructors Constructor Description EdCli()
Creates a new instance able to handle command line operations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.ldaptive.LdapEntry
authenticate(org.apache.commons.cli.CommandLine cmd, String... attributes)
Authenticates the user specified on the command line.void
authorize(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry)
Authenticates and authorizes the user using command line options.void
displayAffiliations(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry)
Authenticates the user specified on the command line and displays their affiliations.void
displayGroupMembership(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry)
Authenticates the user specified on the command line and displays their group membership.org.apache.commons.cli.Options
getOptions()
Gets the Commons CLI options available for this command line client.static void
main(String[] args)
Application entry point for command line operations.void
query(org.apache.commons.cli.CommandLine cmd)
Executes a query specified on the command line and displays the requested attributes on standard out.
-
-
-
Field Detail
-
HELP_OPTION
public static final String HELP_OPTION
Help option flag.- See Also:
- Constant Field Values
-
HELP_LONG_OPTION
public static final String HELP_LONG_OPTION
Help long option flag.- See Also:
- Constant Field Values
-
TYPE_OPTION
public static final String TYPE_OPTION
Directory type option.- See Also:
- Constant Field Values
-
ENV_OPTION
public static final String ENV_OPTION
Directory environment option.- See Also:
- Constant Field Values
-
QUERY_OPTION
public static final String QUERY_OPTION
Query option flag.- See Also:
- Constant Field Values
-
AUTHN_OPTION
public static final String AUTHN_OPTION
Authenticate option flag.- See Also:
- Constant Field Values
-
MFA_OPTION
public static final String MFA_OPTION
Use MFA option flag.- See Also:
- Constant Field Values
-
MFA_VALUE_OPTION
public static final String MFA_VALUE_OPTION
Use MFA value option flag.- See Also:
- Constant Field Values
-
AUTHZ_OPTION
public static final String AUTHZ_OPTION
Authorize option flag.- See Also:
- Constant Field Values
-
USER_OPTION
public static final String USER_OPTION
User option flag.- See Also:
- Constant Field Values
-
CREDENTIAL_OPTION
public static final String CREDENTIAL_OPTION
Credential option flag.- See Also:
- Constant Field Values
-
SHOW_AFFILIATIONS_OPTION
public static final String SHOW_AFFILIATIONS_OPTION
Show affiliations option flag.- See Also:
- Constant Field Values
-
SHOW_GROUP_MEMBERSHIP_OPTION
public static final String SHOW_GROUP_MEMBERSHIP_OPTION
Show group membership option flag.- See Also:
- Constant Field Values
-
-
Method Detail
-
getOptions
public org.apache.commons.cli.Options getOptions()
Gets the Commons CLI options available for this command line client.- Returns:
- Available options.
-
query
public void query(org.apache.commons.cli.CommandLine cmd) throws Exception
Executes a query specified on the command line and displays the requested attributes on standard out.- Parameters:
cmd
- Command line.- Throws:
Exception
- On any failure
-
authenticate
public org.ldaptive.LdapEntry authenticate(org.apache.commons.cli.CommandLine cmd, String... attributes) throws Exception
Authenticates the user specified on the command line. If no credential was supplied on the command line, it is prompted to be read from standard input.- Parameters:
cmd
- Command line.attributes
- Attributes to return- Returns:
- Found
LdapEntry
- Throws:
Exception
- On any failure
-
authorize
public final void authorize(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry) throws Exception
Authenticates and authorizes the user using command line options. If no credential was supplied on the command line, it is prompted to be read from standard input.- Parameters:
cmd
- Command line.entry
-LdapEntry
of authenticated use information, may be null- Throws:
Exception
- On any failure
-
displayGroupMembership
public void displayGroupMembership(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry) throws Exception
Authenticates the user specified on the command line and displays their group membership. If no credential was supplied on the command line, it is prompted to be read from standard input.- Parameters:
cmd
- Command line.entry
-LdapEntry
of authenticated use information, may be null- Throws:
Exception
- On any failure
-
displayAffiliations
public void displayAffiliations(org.apache.commons.cli.CommandLine cmd, org.ldaptive.LdapEntry entry) throws Exception
Authenticates the user specified on the command line and displays their affiliations. If no credential was supplied on the command line, it is prompted to be read from standard input.- Parameters:
cmd
- Command line.entry
-LdapEntry
of authenticated use information, may be null- Throws:
Exception
- On any failure
-
-