com.wles.util
Class SubjectBuilder

java.lang.Object
  extended bycom.wles.util.SubjectBuilder

public class SubjectBuilder
extends java.lang.Object

This class contains static functions to help in constructing and decomposing ASI qualified subjects.


Nested Class Summary
static class SubjectBuilder.Parts
          Parsed representation of a subject.
 
Field Summary
static java.lang.String group_prefix
          Prefix for qualified groups.
static java.lang.String role_prefix
          Prefix for qualified roles.
static java.lang.String user_prefix
          Prefix for qualified users.
 
Constructor Summary
SubjectBuilder()
           
 
Method Summary
static java.lang.String constructRole(java.lang.String name)
          Constructs a qualified role name from an unqualified role name.
static java.lang.String constructSubject(SubjectBuilder.Parts parts)
          Constructs a qualified subject name from subject structure.
static java.lang.String constructSubjectGroup(java.lang.String directory, java.lang.String name)
          Constructs a qualified group name from the directory and unqualified group name.
static java.lang.String constructUser(java.lang.String directory, java.lang.String name)
          Constructs a qualified user from the directory and unqualified user name.
static SubjectBuilder.Parts decomposeSubject(java.lang.String qualname)
          Parses a qualified subject string and seperates it into parts.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

group_prefix

public static final java.lang.String group_prefix
Prefix for qualified groups.

See Also:
Constant Field Values

role_prefix

public static final java.lang.String role_prefix
Prefix for qualified roles.

See Also:
Constant Field Values

user_prefix

public static final java.lang.String user_prefix
Prefix for qualified users.

See Also:
Constant Field Values
Constructor Detail

SubjectBuilder

public SubjectBuilder()
Method Detail

constructRole

public static java.lang.String constructRole(java.lang.String name)
                                      throws BadParameterException
Constructs a qualified role name from an unqualified role name. The generated name will be properly escaped.

Parameters:
name - the name of the role
Returns:
the fully qualified role name
Throws:
BadParameterException

constructSubject

public static java.lang.String constructSubject(SubjectBuilder.Parts parts)
                                         throws BadParameterException
Constructs a qualified subject name from subject structure. Prefix should be //user/ //sgrp/ or //role/. Roles consist of the prefix and a role name. For users and groups there is also a directory and the subject's name is free-form, this function will escape any special characters and terminate the free-form name. This function does no validation of directory or name other then to check that they are non-null.

Parameters:
parts - structure containg the subject's prefix, directory and name.
Returns:
prefix/dir/name with name properly escaped and terminated
Throws:
BadParameterException

constructSubjectGroup

public static java.lang.String constructSubjectGroup(java.lang.String directory,
                                                     java.lang.String name)
                                              throws BadParameterException
Constructs a qualified group name from the directory and unqualified group name. The generated name will be properly escaped and terminated.

Parameters:
directory - the directory for the user
name - the name of the group
Returns:
the fully qualified group name
Throws:
BadParameterException

constructUser

public static java.lang.String constructUser(java.lang.String directory,
                                             java.lang.String name)
                                      throws BadParameterException
Constructs a qualified user from the directory and unqualified user name. The generated name will be properly escaped and terminated.

Parameters:
directory - the directory for the user
name - the name of the user
Returns:
the fully qualified user name
Throws:
BadParameterException

decomposeSubject

public static SubjectBuilder.Parts decomposeSubject(java.lang.String qualname)
                                             throws BadParameterException
Parses a qualified subject string and seperates it into parts. This can be a user, group, or role. For group or user the name portion will get unescaped and unterminated as part of this operation. Roles do not contain directories, so the directory field in the return result will be null.

Parameters:
qualname - fully qualified escaped subject name
Returns:
decomposed subject, where name is unescaped and unterminated
Throws:
BadParameterException


Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.