edu.internet2.middleware.shibboleth.common.attribute
Class AttributeAuthorityCLI

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.common.attribute.AttributeAuthorityCLI

public class AttributeAuthorityCLI
extends Object

A command line tool that allows individuals to invoke an attribute authority and inspect the resultant attribute statement. This tool expects to retrieve the MetadataProvider it uses under the bean name SAMLMetadataProvider, a SAML1AttributeAuthority under the bean name SAML1AttributeAuthority, and a SAML2AttributeAuthority under the bean name SAML2AttributeAuthority.


Nested Class Summary
private static class AttributeAuthorityCLI.CLIParserBuilder
          Helper class that creates the command line argument parser.
 
Field Summary
private static String[] aacliConfigs
          List of assumed Spring configuration files used with the AACLI.
private static org.slf4j.Logger log
          Class logger.
private static SAML1AttributeAuthority saml1AA
          Loaded SAML 1 Attribute Authority.
private static SAML2AttributeAuthority saml2AA
          Loaded SAML 2 Attribute Authority.
 
Constructor Summary
AttributeAuthorityCLI()
           
 
Method Summary
private static BaseSAMLProfileRequestContext buildAttributeRequestContext(jargs.gnu.CmdLineParser parser, org.springframework.context.ApplicationContext appCtx)
          Builds the attribute request context from the command line arguments.
private static void errorAndExit(String errorMessage, Exception e)
          Logs, as an error, the error message and exits the program.
private static org.springframework.context.ApplicationContext loadConfigurations(String configDir, String springExts)
          Loads the configuration files into a Spring application context.
private static void loadLoggingConfiguration(String configDir)
          Loads the logging configuration.
static void main(String[] args)
          Runs this application.
private static jargs.gnu.CmdLineParser parseCommandArguments(String[] args)
          Parses the command line arguments
private static org.opensaml.common.SAMLObject performSAML1AttributeResolution(jargs.gnu.CmdLineParser parser, org.springframework.context.ApplicationContext appCtx)
          Constructs a SAML 1 attribute statement with the retrieved and filtered attributes.
private static org.opensaml.common.SAMLObject performSAML2AttributeResolution(jargs.gnu.CmdLineParser parser, org.springframework.context.ApplicationContext appCtx)
          Constructs a SAML 2 attribute statement with the retrieved and filtered attributes.
private static void printAttributeStatement(org.opensaml.common.SAMLObject attributeStatement)
          Prints the given attribute statement to system output.
private static void printHelp(PrintStream out)
          Prints a help message to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.slf4j.Logger log
Class logger.


aacliConfigs

private static String[] aacliConfigs
List of assumed Spring configuration files used with the AACLI.


saml1AA

private static SAML1AttributeAuthority saml1AA
Loaded SAML 1 Attribute Authority.


saml2AA

private static SAML2AttributeAuthority saml2AA
Loaded SAML 2 Attribute Authority.

Constructor Detail

AttributeAuthorityCLI

public AttributeAuthorityCLI()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Runs this application. Help message prints if no arguments are given or if the "help" argument is given.

Parameters:
args - command line arguments
Throws:
Exception - thrown if there is a problem during program execution

parseCommandArguments

private static jargs.gnu.CmdLineParser parseCommandArguments(String[] args)
                                                      throws Exception
Parses the command line arguments

Parameters:
args - command line arguments
Returns:
parsed command line arguments
Throws:
Exception - thrown if the underlying libraries could not be initialized

loadConfigurations

private static org.springframework.context.ApplicationContext loadConfigurations(String configDir,
                                                                                 String springExts)
                                                                          throws IOException,
                                                                                 org.opensaml.util.resource.ResourceException
Loads the configuration files into a Spring application context.

Parameters:
configDir - directory containing spring configuration files
springExts - colon-separated list of spring extension files
Returns:
loaded application context
Throws:
IOException - throw if there is an error loading the configuration files
org.opensaml.util.resource.ResourceException - if there is an error loading the configuration files

loadLoggingConfiguration

private static void loadLoggingConfiguration(String configDir)
Loads the logging configuration.

Parameters:
configDir - IdP configuration directory

performSAML1AttributeResolution

private static org.opensaml.common.SAMLObject performSAML1AttributeResolution(jargs.gnu.CmdLineParser parser,
                                                                              org.springframework.context.ApplicationContext appCtx)
Constructs a SAML 1 attribute statement with the retrieved and filtered attributes.

Parameters:
parser - command line arguments
appCtx - spring application context with loaded attribute authority
Returns:
SAML 1 attribute statement

performSAML2AttributeResolution

private static org.opensaml.common.SAMLObject performSAML2AttributeResolution(jargs.gnu.CmdLineParser parser,
                                                                              org.springframework.context.ApplicationContext appCtx)
Constructs a SAML 2 attribute statement with the retrieved and filtered attributes.

Parameters:
parser - command line arguments
appCtx - spring application context with loaded attribute authority
Returns:
SAML 2 attribute statement

buildAttributeRequestContext

private static BaseSAMLProfileRequestContext buildAttributeRequestContext(jargs.gnu.CmdLineParser parser,
                                                                          org.springframework.context.ApplicationContext appCtx)
Builds the attribute request context from the command line arguments.

Parameters:
parser - command line argument parser
appCtx - spring application context
Returns:
attribute request context

printAttributeStatement

private static void printAttributeStatement(org.opensaml.common.SAMLObject attributeStatement)
Prints the given attribute statement to system output.

Parameters:
attributeStatement - attribute statement to print

printHelp

private static void printHelp(PrintStream out)
Prints a help message to the given output stream.

Parameters:
out - output to print the help message to

errorAndExit

private static void errorAndExit(String errorMessage,
                                 Exception e)
Logs, as an error, the error message and exits the program.

Parameters:
errorMessage - error message
e - exception that caused it


Copyright © 1999-2012. All Rights Reserved.