JXTA

net.jxta.impl.membership.pse
Class PSEMembershipService

java.lang.Object
  extended by net.jxta.impl.membership.pse.PSEMembershipService
All Implemented Interfaces:
MembershipService, Module, Service

public final class PSEMembershipService
extends Object
implements MembershipService

A JXTA Membership Service utilizing PKI to provide secure identities.

See Also:
MembershipService

Field Summary
(package private)  PeerGroup group
          the peergroup to which this service is associated.
(package private)  PSEPeerSecurityEngine peerSecurityEngine
          PSEPeerSecurityEngine ( and PSEAuthenticatorEngine ) loader
static ModuleSpecID pseMembershipSpecID
          Well known service specification identifier: pse membership
(package private)  PSEConfig pseStore
          the keystore we are working with.
 
Fields inherited from interface net.jxta.membership.MembershipService
ADD_CREDENTIAL_PROPERTY, DEFAULT_CREDENTIAL_PROPERTY
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK
 
Constructor Summary
PSEMembershipService()
          Default constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a listener
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener.
 Authenticator apply(AuthenticationCredential application)
          Request the necessary credentials to join the group with which this service is associated.
(package private)  X509Certificate[] generateServiceCertificate(ID assignedID, PSECredential credential)
          Generate a new service certificate for the assigned ID given an authenticated local credential.
 ID getAssignedID()
           
 Enumeration<AuthenticationCredential> getAuthCredentials()
          Returns the authentication credentials which were used to establish the current identities.
 Enumeration<Credential> getCurrentCredentials()
          Returns the current credentials for this peer.
 Credential getDefaultCredential()
          Returns the default credential for this peer.
 PeerGroup getGroup()
           
 Advertisement getImplAdvertisement()
          Returns the advertisement for this service.
 Service getInterface()
          Service objects are not manipulated directly to protect usage of the service.
 PSEConfig getPSEConfig()
          Returns the key store object associated with this PSE Membership Service.
 PSECredential getServiceCredential(ID assignedID, PSECredential credential)
          Recover the service credential for the assigned ID given an authenticated local credential.
 void init(PeerGroup group, ID assignedID, Advertisement impl)
          Initialize the module, passing it its peer group and advertisement.
 Credential join(Authenticator authenticated)
          Join the group by virtue of the completed authentication provided.
 Credential makeCredential(Element element)
          Given a fragment of a StructuredDocument, reconstruct a Credential object from that fragment.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a listener
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a listener
 void resign()
          Resign all credentials which were previously gained through prior join() operations.
 int startApp(String[] arg)
          Complete any remaining initialization of the module.
 void stopApp()
          Stop a module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pseMembershipSpecID

public static final ModuleSpecID pseMembershipSpecID
Well known service specification identifier: pse membership


group

PeerGroup group
the peergroup to which this service is associated.


pseStore

PSEConfig pseStore
the keystore we are working with.


peerSecurityEngine

PSEPeerSecurityEngine peerSecurityEngine
PSEPeerSecurityEngine ( and PSEAuthenticatorEngine ) loader

Constructor Detail

PSEMembershipService

public PSEMembershipService()
                     throws PeerGroupException
Default constructor. Normally only called by the peer group.

Throws:
PeerGroupException
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: net.jxta.membership.MembershipService
Add a listener

Specified by:
addPropertyChangeListener in interface MembershipService
Parameters:
listener - the listener

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: net.jxta.membership.MembershipService
Add a listener. Available properties from all Membership Services are :

Membership Services may offer additional properties.

Specified by:
addPropertyChangeListener in interface MembershipService
Parameters:
propertyName - The property to watch
listener - The listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: net.jxta.membership.MembershipService
Remove a listener

Specified by:
removePropertyChangeListener in interface MembershipService
Parameters:
listener - the listener

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Description copied from interface: net.jxta.membership.MembershipService
Remove a listener

Specified by:
removePropertyChangeListener in interface MembershipService
Parameters:
propertyName - the property which was watched
listener - the listener

init

public void init(PeerGroup group,
                 ID assignedID,
                 Advertisement impl)
          throws PeerGroupException
Initialize the module, passing it its peer group and advertisement.

Note: when subclassing one of the existing PeerGroup implementations (which implement Module), it may not be recommended to overload the init method. See the documentation of the PeerGroup class being subclassed.

Specified by:
init in interface Module
Parameters:
group - The PeerGroup from which this Module can obtain services. If this module is a Service, this is also the PeerGroup of which this module is a service.
assignedID - Identity of Module within group. modules can use it as a the root of their namespace to create names that are unique within the group but predictable by the same module on another peer. This is normally the ModuleClassID which is also the name under which the module is known by other modules. For a group it is the PeerGroupID itself. The parameters of a service, in the Peer configuration, are indexed by the assignedID of that service, and a Service must publish its run-time parameters in the Peer Advertisement under its assigned ID.
impl - The implementation advertisement for this Module. It is permissible to pass null if no implementation advertisement is available. This may happen if the implementation was selected by explicit class name rather than by following an implementation advertisement. Modules are not required to support that style of loading, but if they do, then their documentation should mention it.
Throws:
PeerGroupException - This module failed to initialize.

getInterface

public Service getInterface()
Service objects are not manipulated directly to protect usage of the service. A Service interface is returned to access the service methods.

Specified by:
getInterface in interface Service
Returns:
Service public interface of the service

getImplAdvertisement

public Advertisement getImplAdvertisement()
Returns the advertisement for this service.

Specified by:
getImplAdvertisement in interface Service
Returns:
Advertisement the advertisement. This is always a ModuleImplAdvertisement.

startApp

public int startApp(String[] arg)
Complete any remaining initialization of the module. The module should be fully functional after startApp() is completed. That is also the opportunity to supply arbitrary arguments (mostly to applications).

If this module is a PeerGroup service, it may be invoked several times depending on its return value.

Currently this service starts by itself and does not expect arguments.

Specified by:
startApp in interface Module
Parameters:
arg - An array of Strings forming the parameters for this Module.
Returns:
int A status indication which may be one of Module.START_OK, Module.START_AGAIN_PROGRESS, Module.START_AGAIN_STALLED, which indicates partial or complete success, or any other value (negative values are recommended for future compatibility), which indicates failure.

stopApp

public void stopApp()
Stop a module. This may be called any time after init() completes and should not assume that startApp() has been called or completed.

The Module cannot be forced to comply, but in the future we might be able to deny it access to anything after some timeout.

Specified by:
stopApp in interface Module

getGroup

public PeerGroup getGroup()

getAssignedID

public ID getAssignedID()

apply

public Authenticator apply(AuthenticationCredential application)
                    throws ProtocolNotSupportedException
Request the necessary credentials to join the group with which this service is associated.

Supports methods "StringAuthentication", "DialogAuthentication", "EngineAuthentication" and "InteractiveAuthentication" (an alias for "DialogAuthentication")

Specified by:
apply in interface MembershipService
Parameters:
application - The authentication Credential associated with this membership application. See AuthenticationCredential for more information.
Returns:
An Authenticator for the membership service.
Throws:
ProtocolNotSupportedException - if the authentication method requested in the application is not supported by this service.

getDefaultCredential

public Credential getDefaultCredential()
Returns the default credential for this peer.

Specified by:
getDefaultCredential in interface MembershipService
Returns:
The current default Credential or null if there is no current default.

getCurrentCredentials

public Enumeration<Credential> getCurrentCredentials()
Returns the current credentials for this peer.

Specified by:
getCurrentCredentials in interface MembershipService
Returns:
Enumeration of the Credentials currently associated with this peer for this peergroup.

getAuthCredentials

public Enumeration<AuthenticationCredential> getAuthCredentials()
Returns the authentication credentials which were used to establish the current identities.

Specified by:
getAuthCredentials in interface MembershipService
Returns:
Enumeration of the AuthenticationCredentials which were used to establish the current identities.

join

public Credential join(Authenticator authenticated)
                throws PeerGroupException
Join the group by virtue of the completed authentication provided.

Specified by:
join in interface MembershipService
Parameters:
authenticated - the completed authentication.
Returns:
Credential the credential for this completed authentication.
Throws:
PeerGroupException - Thrown in the event of errors.

resign

public void resign()
Resign all credentials which were previously gained through prior join() operations.

Specified by:
resign in interface MembershipService

makeCredential

public Credential makeCredential(Element element)
Given a fragment of a StructuredDocument, reconstruct a Credential object from that fragment.

Specified by:
makeCredential in interface MembershipService
Parameters:
element - The StructuredDocument fragment to use for building the credential.
Returns:
Credential The created credential

getPSEConfig

public PSEConfig getPSEConfig()
Returns the key store object associated with this PSE Membership Service.


generateServiceCertificate

X509Certificate[] generateServiceCertificate(ID assignedID,
                                             PSECredential credential)
                                       throws IOException,
                                              KeyStoreException,
                                              InvalidKeyException,
                                              SignatureException
Generate a new service certificate for the assigned ID given an authenticated local credential.

Parameters:
assignedID - The assigned ID of the service credential.
credential - The issuer credential for the service credential.
Throws:
IOException
KeyStoreException
InvalidKeyException
SignatureException

getServiceCredential

public PSECredential getServiceCredential(ID assignedID,
                                          PSECredential credential)
                                   throws IOException,
                                          PeerGroupException,
                                          InvalidKeyException,
                                          SignatureException
Recover the service credential for the assigned ID given an authenticated local credential.

Parameters:
assignedID - The assigned ID of the service credential.
credential - The issuer credential for the service credential.
Throws:
IOException
PeerGroupException
InvalidKeyException
SignatureException

JXSE