issrg.pba.rbac
Class URLPrincipal

java.lang.Object
  extended by issrg.pba.rbac.URLPrincipal
All Implemented Interfaces:
Entry, java.security.Principal

public class URLPrincipal
extends java.lang.Object
implements java.security.Principal, Entry

This class implements a Principal interface, so it can be used as an identifier. It also implements an Entry interface, so it can be used for Domain matching as well.

Some of the methods do not have any description, because they simply redirect the calls to ParsedURL object, so refer to the description of that class to see the meaning of the results.

Author:
A.Otenko

Constructor Summary
protected URLPrincipal()
           
  URLPrincipal(java.lang.String url)
          This constructor builds a URLPrincipal out of a URL string, and assumes the defaul port is unknown (getPort() will return -1, if the URL does not specify the port number).
  URLPrincipal(java.lang.String url, int defaultPort)
          This constructor builds a URLPrincipal given a URL string, and a default port number.
 
Method Summary
 java.lang.String getAnchor()
           
 java.security.Principal getEntryName()
          This method returns the Principal naming the entry.
 java.lang.String getHost()
           
 java.lang.String getName()
          This method returns a normalised URL (i.e. the path is without '.' and '..' elements, etc.)
 java.lang.String[] getOriginalPath()
           
 java.lang.String getPassword()
           
 java.lang.String[] getPath()
           
 int getPort()
          This method returns a port number.
 java.lang.String getProtocol()
           
 java.lang.String getQuery()
           
 java.lang.String getURL()
          This method returns the whole original URL; normalised URL can be obtained using getName() method.
 java.lang.String getUserName()
           
 
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
 

Constructor Detail

URLPrincipal

protected URLPrincipal()

URLPrincipal

public URLPrincipal(java.lang.String url)
             throws BadURLException
This constructor builds a URLPrincipal out of a URL string, and assumes the defaul port is unknown (getPort() will return -1, if the URL does not specify the port number).

This is equivalent to new URLPrincipal(url, -1);

Parameters:
url - is the string URL
Throws:
BadURLException - if the url is not a well-formed HTTP or FILE URL

URLPrincipal

public URLPrincipal(java.lang.String url,
                    int defaultPort)
             throws BadURLException
This constructor builds a URLPrincipal given a URL string, and a default port number.

Parameters:
url - is the string URL
defaultPort - is the number of the default port to assume if URL does not specify any port number
Throws:
BadURLException - if the url is not a well-formed HTTP or FILE URL
Method Detail

getName

public java.lang.String getName()
This method returns a normalised URL (i.e. the path is without '.' and '..' elements, etc.)

Specified by:
getName in interface java.security.Principal

getEntryName

public java.security.Principal getEntryName()
Description copied from interface: Entry
This method returns the Principal naming the entry.

Specified by:
getEntryName in interface Entry
Returns:
Principal naming the entry; cannot be null

getProtocol

public java.lang.String getProtocol()

getUserName

public java.lang.String getUserName()

getPassword

public java.lang.String getPassword()

getHost

public java.lang.String getHost()

getPort

public int getPort()
This method returns a port number. Returns -1, if no port has been specified in the URL or in the constructor (use default).

Returns:
the port number, or -1, if no port has been specified in the URL

getPath

public java.lang.String[] getPath()

getOriginalPath

public java.lang.String[] getOriginalPath()

getAnchor

public java.lang.String getAnchor()

getQuery

public java.lang.String getQuery()

getURL

public java.lang.String getURL()
This method returns the whole original URL; normalised URL can be obtained using getName() method.