Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.security
Class InitialSecurityContextFactory

    java.lang.Object
      org.jasig.portal.security.InitialSecurityContextFactory

    public class InitialSecurityContextFactory

extends java.lang.Object

This class provides a static "factory" method that returns a security context retrieved based on the information provided in security.properties, including all relevant subcontexts. A typical sequence would be:

     SecurityContext sec = InitialSecurityContextFactory.getInitialContext("root");
     Principal princ = sec.getPrincipalInstance();
     OpaqueCredentials pwd = sec.getOpaqueCredentialsInstance();
     princ.setUID("user");
     pwd.setCredentials("password");
     sec.authenticate();
     if (sec.isAuthenticated())
      System.out.println("Yup");
     else
      System.out.println("Nope");

Version:
  $Revision: 1.17 $
Author:
  Andrew Newman, newman@yale.edu, Susan Bramhall (susan.bramhall@yale.edu), Shawn Bayern (shawn.bayern@yale.edu), Eric Dalquist edalquist@unicon.net

Field Summary
`private static java.lang.String` | `CONTEXT_PROPERTY_PREFIX`
`private static java.util.Map` | `contextConfigCache` Used to store the configuration for each initial context, this allows a the ISecurityContext chain to be created more quickly since the properties file doesn't need to be parsed at each getInitialContext call.
`private static org.apache.commons.logging.Log` | `log`

Constructor Summary
`InitialSecurityContextFactory()`

Method Summary
`private static ISecurityContext` | `createSecurityContextChain(ContextConfiguration contextConfig)` Recursivly parses the tree of `ContextConfiguration` objects to create a tree (chain) of `ISecurityContext`s.
`static ISecurityContext` | `getInitialContext(java.lang.String rootContext)`
`private static ContextConfiguration` | `loadContextConfigurationChain(java.lang.String fullContextName, java.util.Properties securtiyProperties)` This method parses the `Properties` file to find the configuration for the specified context.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final org.apache.commons.logging.Log log

### CONTEXT_PROPERTY_PREFIX

    private static final java.lang.String CONTEXT_PROPERTY_PREFIX

See Also:
  Constant Field Values

### contextConfigCache

    private static final java.util.Map contextConfigCache

  Used to store the configuration for each initial context, this allows a the ISecurityContext chain to be created more quickly since the properties file doesn't need to be parsed at each getInitialContext call.

Constructor Detail

### InitialSecurityContextFactory

    public InitialSecurityContextFactory()

Method Detail

### getInitialContext

    public static ISecurityContext getInitialContext(java.lang.String rootContext)
                                              throws PortalSecurityException

  Throws:
    `PortalSecurityException`

### createSecurityContextChain

    private static ISecurityContext createSecurityContextChain(ContextConfiguration contextConfig)
                                                        throws PortalSecurityException

  Recursivly parses the tree of `ContextConfiguration` objects to create a tree (chain) of `ISecurityContext`s. The root context is returned by the method after all of it's sub-contexts have been created and configured.

  Parameters:
    `contextConfig` - The `ContextConfiguration` to use as the root
  Returns:
    A configured `ISecurityContext`
  Throws:
    `PortalSecurityException` - If an excetion is thrown by the `ISecurityContext.addSubContext(String, ISecurityContext)` method.

### loadContextConfigurationChain

    private static ContextConfiguration loadContextConfigurationChain(java.lang.String fullContextName,
                                                                      java.util.Properties securtiyProperties)
                                                               throws PortalSecurityException

  This method parses the `Properties` file to find the configuration for the specified context. The factory is loaded and the configuration is named then the `Properties` are parsed to find all context configuration properties and sub-contexts for this context. For each sub-context this method is called recursivly.

  Parameters:
    `fullContextName` - The fully qualified name of the context to configure.
    `securtiyProperties` - The `Properties` to use for configuration.
  Returns:
    A fully configured `ContextConfiguration` object.
  Throws:
    `PortalSecurityException` - If no context with the specified named exists or the factory cannot be created.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD