uk.ac.soton.itinnovation.grid.pbac2.pdp.webadmin
Class ACLadmin

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.pbac2.pdp.webadmin.ACLadmin

public class ACLadmin
extends Object

Provides code to create a web administration interface for PBAC access control lists. To use it, create a new ACLadmin object in your JSP page and then call processPOST(). Call showRules() to display a table showing the current rules, and allowing the user to add and remove rules.


Field Summary
static int TYPE_ANYONE
           
static int TYPE_CA
           
static int TYPE_MEMBER
           
static int TYPE_NONE
           
static int TYPE_SAML
           
static int TYPE_SUBJECT_DN
           
static int TYPE_TRUSTED_START
           
 
Constructor Summary
ACLadmin(HttpServletRequest request)
          Convenience constructor with other arguments set to null.
ACLadmin(HttpServletRequest request, HttpServletResponse response)
           
ACLadmin(HttpServletRequest request, String resourceID)
          Convenience constructor with other arguments set to null.
ACLadmin(HttpServletRequest request, String resourceID, HttpServletResponse response)
           
ACLadmin(HttpServletRequest request, String resourceID, String fragment, HttpServletResponse response)
          Create a new ACLadmin from the parameters in this request.
 
Method Summary
 void addTrustedAttributeType(String name, String menuText, String formText)
          Add a trusted attribute that the user can add to this ACL.
static String escapeHTML(Object object)
           
 String formatAuthorityHTML(MatchRule rule)
          Format the authority field of a MatchRule.
 String formatRuleTypeHTML(MatchRule rule)
          Format the deny field of a MatchRule.
 String formatSubjectHTML(MatchRule rule)
          Format the subject field of a MatchRule.
 String formatTrustedAttributeTypeHTML(int typeid)
          Format the label for a TrustedAttributeType value box (e.g.
 Map<String,String> getDeleteParameters(MatchRule rule)
          Get the details needed to identify a match rule to be deleted.
static String getGroupAdminPrefix()
          Deprecated. See getGroupAdminPrefix(HttpServletRequest)
static String getGroupAdminPrefix(HttpServletRequest request)
          Get the prefix for a relative link to the group ACL admin page.
 String getResourceType()
           
 boolean hasAuthorityCertificate(MatchRule rule)
          Check whether this match rule has a certificate.
 String processPOST()
          Check whether this request is a POST asking us to update the ACLs.
 void showRules(Writer out)
          Show the access control list for this resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NONE

public static final int TYPE_NONE
See Also:
Constant Field Values

TYPE_SUBJECT_DN

public static final int TYPE_SUBJECT_DN
See Also:
Constant Field Values

TYPE_CA

public static final int TYPE_CA
See Also:
Constant Field Values

TYPE_SAML

public static final int TYPE_SAML
See Also:
Constant Field Values

TYPE_MEMBER

public static final int TYPE_MEMBER
See Also:
Constant Field Values

TYPE_ANYONE

public static final int TYPE_ANYONE
See Also:
Constant Field Values

TYPE_TRUSTED_START

public static final int TYPE_TRUSTED_START
See Also:
Constant Field Values
Constructor Detail

ACLadmin

public ACLadmin(HttpServletRequest request)
         throws Stop,
                InvalidResourceIDException
Convenience constructor with other arguments set to null.

Throws:
Stop
InvalidResourceIDException

ACLadmin

public ACLadmin(HttpServletRequest request,
                String resourceID)
         throws Stop,
                InvalidResourceIDException
Convenience constructor with other arguments set to null.

Throws:
Stop
InvalidResourceIDException

ACLadmin

public ACLadmin(HttpServletRequest request,
                String resourceID,
                HttpServletResponse response)
         throws Stop,
                InvalidResourceIDException
Throws:
Stop
InvalidResourceIDException

ACLadmin

public ACLadmin(HttpServletRequest request,
                HttpServletResponse response)
         throws Stop,
                InvalidResourceIDException
Throws:
Stop
InvalidResourceIDException

ACLadmin

public ACLadmin(HttpServletRequest request,
                String resourceID,
                String fragment,
                HttpServletResponse response)
         throws Stop,
                InvalidResourceIDException
Create a new ACLadmin from the parameters in this request.

Parameters:
request - servlet's request object
resourceID - resource to use. If null, uses request.getParameter("resource")
fragment - fragment identifier to add to links (e.g. "acl" to link to "page.jsp#acl")
Throws:
Stop
InvalidResourceIDException
Method Detail

getGroupAdminPrefix

public static String getGroupAdminPrefix()
Deprecated. See getGroupAdminPrefix(HttpServletRequest)

Get the prefix for a relative link to the group ACL admin page. ACLadmin.groupadmin.prefix must contain an old-style prefix (starting with /webapp-name).


getGroupAdminPrefix

public static String getGroupAdminPrefix(HttpServletRequest request)
Get the prefix for a relative link to the group ACL admin page. The prefix is found by combining the webapp base from the request with the prefix in ACLadmin.groupadmin.prefix.

Parameters:
request - HttpServletRequest

processPOST

public String processPOST()
                   throws Stop,
                          GridFailureException,
                          org.apache.commons.fileupload.FileUploadException,
                          CertificateException,
                          IOException
Check whether this request is a POST asking us to update the ACLs. If so, do the updates.

Returns:
a success message, or null if no action was performed
Throws:
Stop
GridFailureException
org.apache.commons.fileupload.FileUploadException
CertificateException
IOException

showRules

public void showRules(Writer out)
               throws IOException,
                      GridFailureException
Show the access control list for this resource. The user will be able to add and remove rules.

Throws:
IOException
GridFailureException

formatRuleTypeHTML

public String formatRuleTypeHTML(MatchRule rule)
Format the deny field of a MatchRule.

Parameters:
rule - the rule to be formatted for display
Returns:
an HTML fragment representing the value

formatSubjectHTML

public String formatSubjectHTML(MatchRule rule)
Format the subject field of a MatchRule.

Parameters:
rule - the rule to be formatted for display
Returns:
an HTML fragment representing the value

formatAuthorityHTML

public String formatAuthorityHTML(MatchRule rule)
Format the authority field of a MatchRule.

Parameters:
rule - the rule to be formatted for display
Returns:
an HTML fragment representing the value

formatTrustedAttributeTypeHTML

public String formatTrustedAttributeTypeHTML(int typeid)
Format the label for a TrustedAttributeType value box (e.g. "User name:").

Parameters:
typeid - the id of the TrustedAttributeType to be formatted for display
Returns:
an HTML fragment representing the value

hasAuthorityCertificate

public boolean hasAuthorityCertificate(MatchRule rule)
Check whether this match rule has a certificate. This can be used to decide whether to offer a 'Download certificate' action.

Parameters:
rule - the rule to be checked
Returns:
true iff there is a certificate

getDeleteParameters

public Map<String,String> getDeleteParameters(MatchRule rule)
Get the details needed to identify a match rule to be deleted. The values in the returned map can be used later to delete this rule. They will typically be added to an HTML form as hidden values.

Parameters:
rule - the rule to be deleted
Returns:
a map containing the names and values of the required attributes

escapeHTML

public static String escapeHTML(Object object)

getResourceType

public String getResourceType()

addTrustedAttributeType

public void addTrustedAttributeType(String name,
                                    String menuText,
                                    String formText)
Add a trusted attribute that the user can add to this ACL.

Parameters:
name - the attribute name
menuText - the label for the menu (e.g. "User name is ...")
formText - the label for the value box (e.g. "User name:")
See Also:
TrustedAttribute


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.