uk.ac.rdg.resc.jstyx.server
Class StyxSecurityContext

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.server.StyxSecurityContext

public class StyxSecurityContext
extends java.lang.Object

Describes security information for a Styx server. This is used for finding valid users and groups and whether or not anonymous logins are allowed.

Author:
Jon Blower $Revision: 604 $ $Date: 2006-03-21 14:58:42 +0000 (Tue, 21 Mar 2006) $ $Log$ Revision 1.3 2006/03/21 14:58:42 jonblower Implemented clear-text password-based authentication and did some simple tests Revision 1.2 2006/03/21 09:06:15 jonblower Still implementing authentication Revision 1.1 2006/03/20 17:51:50 jonblower Adding authentication to base JStyx system

Constructor Summary
StyxSecurityContext()
          Creates a security context in which anonymous logins are allowed, SSL is not used and authentication is not supported
StyxSecurityContext(java.lang.String securityFile)
          Creates a new StyxSecurityContext from a configuration file
 
Method Summary
 boolean allowsAnonymousLogin()
           
 User getAnonymousUser()
           
 javax.net.ssl.SSLContext getSSLContext()
           
 User getUser(java.lang.String username)
           
 boolean isMember(java.lang.String username, java.lang.String group)
           
static void main(java.lang.String[] args)
          Simple test routine
 boolean supportsAuthentication()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyxSecurityContext

public StyxSecurityContext()
Creates a security context in which anonymous logins are allowed, SSL is not used and authentication is not supported


StyxSecurityContext

public StyxSecurityContext(java.lang.String securityFile)
                    throws StyxSecurityException
Creates a new StyxSecurityContext from a configuration file

Parameters:
securityFile - XML File from which security information is to be read. If this is null, access to the server will be anonymous and unsecured.
Throws:
StyxSecurityException - if the security config file could not be read
Method Detail

allowsAnonymousLogin

public boolean allowsAnonymousLogin()
Returns:
true if this security context allows users to login anonymously

supportsAuthentication

public boolean supportsAuthentication()
Returns:
true if this server supports authentication

getSSLContext

public javax.net.ssl.SSLContext getSSLContext()
Returns:
the SSLContext for this server, or null if we are not using SSL

getAnonymousUser

public User getAnonymousUser()
Returns:
a User object for the anonymous user

getUser

public User getUser(java.lang.String username)
             throws StyxSecurityException
Returns:
an object describing the user with the given username
Throws:
StyxSecurityException - if a user with the given name does not exist in this security context or if this server does not support authentication or if there was an error finding the user's details

isMember

public boolean isMember(java.lang.String username,
                        java.lang.String group)
Returns:
true if the given user is a member of the given group. If the group is the default group (StyxUtils.DEFAULT_GROUP) this will return true as all users are members of this group. If the user is the anonymous user (StyxUtils.ANONYMOUS_USER) this will return false unless the group is the default group.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Simple test routine

Throws:
java.lang.Exception


Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.