org.openxri.server.impl
Class TrustedServer

java.lang.Object
  extended by org.openxri.config.impl.AbstractComponent
      extended by org.openxri.server.impl.AbstractServer
          extended by org.openxri.server.impl.BasicServer
              extended by org.openxri.server.impl.TrustedServer
All Implemented Interfaces:
java.io.Serializable, Component, Server

public class TrustedServer
extends BasicServer

An extension to BasicServer that adds trust information to the XRD before it is sent out. TODO: Fix everything and implement trusted resolution correctly.

Author:
=peacekeeper, Peter Williams (home_pw@msn.com)
See Also:
Serialized Form

Field Summary
static java.lang.String CONFIG_CERTIFICATE_LOCATION
           
static java.lang.String CONFIG_CERTIFICATE_LOCATION_DEFAULT
           
static java.lang.String CONFIG_PRIVATE_KEY_LOCATION
           
static java.lang.String CONFIG_PRIVATE_KEY_LOCATION_DEFAULT
           
static java.lang.String CONFIG_SAML_ISSUER
           
static java.lang.String CONFIG_SAML_ISSUER_DEFAULT
           
protected static org.apache.commons.logging.Log log
           
protected  java.lang.String parentQueryName
           
 
Fields inherited from class org.openxri.server.impl.AbstractServer
store
 
Fields inherited from class org.openxri.config.impl.AbstractComponent
properties
 
Constructor Summary
TrustedServer(java.util.Properties properties)
           
 
Method Summary
protected  Assertion createAssertion(java.lang.String sXMLID, java.lang.String sParentID, java.lang.String sResolved)
          Generates an assertion that can be attached to the descriptor according to the rules of XRI trusted resolution.
protected  void finishXRD(XRD xrd, Authority parentAuthority, SubSegment subSegment, Authority authority, boolean bSigned)
          Called before the server adds the XRD to the XRDS and moves on to the next authority.
protected  java.security.cert.X509Certificate[] getCertificateChain()
          This method will read a certificate chain from a file and return it.
protected  java.security.PrivateKey getPrivateKey()
          This method will read a private key from a file and return it.
 void init()
          Initialize base-class attributes from configuration.
protected  boolean initXRD(XRD xrd, Authority parentAuthority, java.lang.String subSegmentName, boolean signed)
          Called before anything is added to a fresh XRD.
protected  boolean initXRDS(XRDS xrds, java.lang.String query, boolean bSigned)
          Called before the server starts processing the request.
protected  void setParentQueryName(java.lang.String subSegment)
          This is overriden by the TrustedServer which uses the parent subsegment name for generating SAML assertions.
 
Methods inherited from class org.openxri.server.impl.BasicServer
finishXRDS
 
Methods inherited from class org.openxri.server.impl.AbstractServer
lookupByNamespace, lookupByPath, lookupSelfDescribing, makeExceptionXrd, makeNotFoundXrd
 
Methods inherited from class org.openxri.config.impl.AbstractComponent
getProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openxri.config.Component
getProperties
 

Field Detail

log

protected static org.apache.commons.logging.Log log

CONFIG_CERTIFICATE_LOCATION

public static final java.lang.String CONFIG_CERTIFICATE_LOCATION
See Also:
Constant Field Values

CONFIG_PRIVATE_KEY_LOCATION

public static final java.lang.String CONFIG_PRIVATE_KEY_LOCATION
See Also:
Constant Field Values

CONFIG_SAML_ISSUER

public static final java.lang.String CONFIG_SAML_ISSUER
See Also:
Constant Field Values

CONFIG_CERTIFICATE_LOCATION_DEFAULT

public static final java.lang.String CONFIG_CERTIFICATE_LOCATION_DEFAULT
See Also:
Constant Field Values

CONFIG_PRIVATE_KEY_LOCATION_DEFAULT

public static final java.lang.String CONFIG_PRIVATE_KEY_LOCATION_DEFAULT
See Also:
Constant Field Values

CONFIG_SAML_ISSUER_DEFAULT

public static final java.lang.String CONFIG_SAML_ISSUER_DEFAULT
See Also:
Constant Field Values

parentQueryName

protected java.lang.String parentQueryName
Constructor Detail

TrustedServer

public TrustedServer(java.util.Properties properties)
Method Detail

init

public void init()
Description copied from class: AbstractServer
Initialize base-class attributes from configuration.

Specified by:
init in interface Component
Overrides:
init in class BasicServer

initXRDS

protected boolean initXRDS(XRDS xrds,
                           java.lang.String query,
                           boolean bSigned)
                    throws ServerInternalException
Description copied from class: AbstractServer
Called before the server starts processing the request.

Overrides:
initXRDS in class BasicServer
Parameters:
xrds - - A blank XRDS which we will complete.
query - - The original XRI segment for which the request was made.
bSigned - - Whether we are expected to return a signed descriptor.
Returns:
If true, the AbstractServer will not add anything to the XRDS and send it out immediately.
Throws:
ServerInternalException

initXRD

protected boolean initXRD(XRD xrd,
                          Authority parentAuthority,
                          java.lang.String subSegmentName,
                          boolean signed)
                   throws ServerInternalException
Description copied from class: AbstractServer
Called before anything is added to a fresh XRD.

Overrides:
initXRD in class BasicServer
Parameters:
xrd - - A blank XRD which we will fill.
parentAuthority - - The authority describing this XRD.
subSegmentName - - The name of the subsegment to be resolved.
signed - - Whether we are expected to return a signed descriptor.
Returns:
If true, the AbstractServer will append the XRD to the XRDS and return it without any further processing.
Throws:
ServerInternalException

finishXRD

protected void finishXRD(XRD xrd,
                         Authority parentAuthority,
                         SubSegment subSegment,
                         Authority authority,
                         boolean bSigned)
                  throws ServerInternalException
Description copied from class: AbstractServer
Called before the server adds the XRD to the XRDS and moves on to the next authority. This method should be prepared to handle a null XRD.

Overrides:
finishXRD in class BasicServer
Parameters:
xrd - - A filled XRD ready to be appended to the XRDS.
parentAuthority - - The authority describing this XRD.
subSegment - - The subsegment leading to this XRD.
authority - - The authority described by this XRD.
bSigned - - Whether we are expected to return a signed descriptor.
Throws:
ServerInternalException

createAssertion

protected Assertion createAssertion(java.lang.String sXMLID,
                                    java.lang.String sParentID,
                                    java.lang.String sResolved)
Generates an assertion that can be attached to the descriptor according to the rules of XRI trusted resolution.

Parameters:
sXMLID - - The id attribute of the descriptor
sParentID - - The authority id of the descriptor
sResolved - - The resolved subsegment
Returns:
Assertion that is SAML 2.0 compliant and has the basic information for XRI trusted resolution filled in.

getCertificateChain

protected java.security.cert.X509Certificate[] getCertificateChain()
                                                            throws ServerInternalException
This method will read a certificate chain from a file and return it. The certificate chain is also stored in a member field for subsequent calls to this method. Subclasses can override this to get the certificate chain in some other way.

Throws:
ServerInternalException

getPrivateKey

protected java.security.PrivateKey getPrivateKey()
                                          throws ServerInternalException
This method will read a private key from a file and return it. The private key is also stored in a member field for subsequent calls to this method. Subclasses can override this to get the private key in some other way.

Throws:
ServerInternalException

setParentQueryName

protected void setParentQueryName(java.lang.String subSegment)
Description copied from class: AbstractServer
This is overriden by the TrustedServer which uses the parent subsegment name for generating SAML assertions.

Overrides:
setParentQueryName in class AbstractServer
Parameters:
subSegment - The name of the subsegment that was resolved in the previous step.


Copyright © 2005-2010. All Rights Reserved.