Project JXTA

net.jxta.impl.membership.passwd
Class PasswdMembershipService

java.lang.Object
  extended bynet.jxta.impl.membership.passwd.PasswdMembershipService
All Implemented Interfaces:
MembershipService, Module, Service

public class PasswdMembershipService
extends Object
implements MembershipService

The passwd membership service provides a Membership Service implementation which is based on a password scheme similar to the unix /etc/passwd system.

This implementation is intended as an example of a simple Membership Service and NOT as a practical secure Membership Service.

See Also:
MembershipService

Nested Class Summary
static class PasswdMembershipService.PasswdAuthenticator
          Creates an authenticator for the passwd membership service.
static class PasswdMembershipService.PasswdCredential
          This class provides the sub-class of Credential which is associated with the password membership service.
 
Field Summary
static ModuleSpecID passwordMembershipSpecID
          Well known service specification identifier: password membership
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Constructor Summary
PasswdMembershipService()
          Default constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a listener
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener
 Authenticator apply(AuthenticationCredential application)
          
 Enumeration getAuthCredentials()
          
 Enumeration getCurrentCredentials()
          
 Credential getDefaultCredential()
          
 Advertisement getImplAdvertisement()
          
 Service getInterface()
          
 void init(PeerGroup group, ID assignedID, Advertisement impl)
          
 Credential join(Authenticator authenticated)
          
 Credential makeCredential(Element element)
          
static String makePsswd(String source)
          This is the method used to make the password strings.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a listener
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a listener
 void resign()
          
 int startApp(String[] arg)
          

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

 void stopApp()
          

This request is currently ignored.

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

Field Detail

passwordMembershipSpecID

public static final ModuleSpecID passwordMembershipSpecID
Well known service specification identifier: password membership

Constructor Detail

PasswdMembershipService

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

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a listener

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

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Add a listener

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

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a listener

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

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
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

Specified by:
init in interface Module
Throws:
PeerGroupException

getInterface

public Service getInterface()

Specified by:
getInterface in interface Service

getImplAdvertisement

public Advertisement getImplAdvertisement()

Specified by:
getImplAdvertisement in interface Service

startApp

public int startApp(String[] arg)

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

Specified by:
startApp in interface Module

stopApp

public void stopApp()

This request is currently ignored.

Specified by:
stopApp in interface Module

apply

public Authenticator apply(AuthenticationCredential application)
                    throws PeerGroupException,
                           ProtocolNotSupportedException

Specified by:
apply in interface MembershipService
Throws:
PeerGroupException
ProtocolNotSupportedException

getDefaultCredential

public Credential getDefaultCredential()

Specified by:
getDefaultCredential in interface MembershipService

getCurrentCredentials

public Enumeration getCurrentCredentials()

Specified by:
getCurrentCredentials in interface MembershipService

getAuthCredentials

public Enumeration getAuthCredentials()

Specified by:
getAuthCredentials in interface MembershipService

join

public Credential join(Authenticator authenticated)
                throws PeerGroupException

Specified by:
join in interface MembershipService
Throws:
PeerGroupException

resign

public void resign()

Specified by:
resign in interface MembershipService

makeCredential

public Credential makeCredential(Element element)
                          throws PeerGroupException,
                                 Exception

Specified by:
makeCredential in interface MembershipService
Throws:
PeerGroupException
Exception

makePsswd

public static String makePsswd(String source)
This is the method used to make the password strings. We only provide one way encoding since we can compare the encoded strings.

FIXME 20010402 bondolo : switch to use the standard crypt(3) algorithm for encoding the passwords. The current algorithm has been breakable since ancient times, crypt(3) is also weak, but harder to break.

Parameters:
source - the string to encode
Returns:
String the encoded version of the password.

JXTA J2SE