issrg.pba.rbac
Class ContextNamePrincipal

java.lang.Object
  extended by issrg.pba.rbac.ContextNamePrincipal
All Implemented Interfaces:
java.security.Principal

public class ContextNamePrincipal
extends java.lang.Object
implements java.security.Principal

This class represents a context name, which is corresponding to the context name in a MSoD policy. It is based on RFC2253. Like DN -- distinguished name, it contains a group of variable-value pairs, and the value can be * or $: * means any specific value for this variable, for example, given c=*, then c=21 and c=34 belong to two different context instances; $ means any value regardless of its specific value, for example, given c=$, then c=21 and c=34 belong to the same context instance if other variable/value pairs also match.

Version:
0.1
Author:
W.Xu

Field Summary
static ContextNamePrincipal WHOLE_WORLD_DN
           
 
Constructor Summary
protected ContextNamePrincipal()
           
  ContextNamePrincipal(java.lang.String contextDN)
          This constructor builds the object out of the String representation of the DN.
 
Method Summary
 boolean contains(ContextNamePrincipal con)
          This method is for MSoD rule matching.
 boolean equals(ContextNamePrincipal con)
          This method is to compare two ContextNamePrincipal objects.
 java.lang.String getName()
           
 java.lang.String[][][] getParsedDN()
          Returns the DN as an array, specified by issrg.utils.RFC2253Parser
 ContextNamePrincipal instantiate(ContextNamePrincipal inputCNP)
          This method is for MSoD rule to instantiate a ContextNamePrincipal, i.e. * is instantiated with a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Field Detail

WHOLE_WORLD_DN

public static final ContextNamePrincipal WHOLE_WORLD_DN
Constructor Detail

ContextNamePrincipal

protected ContextNamePrincipal()

ContextNamePrincipal

public ContextNamePrincipal(java.lang.String contextDN)
                     throws RFC2253ParsingException
This constructor builds the object out of the String representation of the DN. It uses issrg.utils.RFC2253NameParser to check if the name can be successfully parsed. If not, an issrg.utils.RFC2253ParsingException is thrown.

Throws:
RFC2253ParsingException
See Also:
RFC2253NameParser, RFC2253ParsingException
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface java.security.Principal

getParsedDN

public java.lang.String[][][] getParsedDN()
Returns the DN as an array, specified by issrg.utils.RFC2253Parser

Returns:
an array of values representing the DN

equals

public boolean equals(ContextNamePrincipal con)
This method is to compare two ContextNamePrincipal objects. If two ContextNamePrincipal equals, then it returns true; otherwise, it returns false.

Parameters:
con - is the input ContextNamePrincipal.
Returns:
true if this ContextNamePrincipal equals the input con according to context name hierarchy; otherwise return false.

contains

public boolean contains(ContextNamePrincipal con)
This method is for MSoD rule matching. If this ContextNamePrincipal contains con according to context match rules, then it returns true; otherwise, false. added for MSoD.

Parameters:
con - is the input ContextNamePrincipal.
Returns:
true if this ContextNamePrincipal contains the input con according to context name hierarchy; otherwise return false.

instantiate

public ContextNamePrincipal instantiate(ContextNamePrincipal inputCNP)
This method is for MSoD rule to instantiate a ContextNamePrincipal, i.e. * is instantiated with a value. added for MSoD.

Parameters:
inputCNP - is the input ContextNamePrincipal.
Returns:
the instantiated contextNamePrincipal, ie * is instantiated with real value.