issrg.jaas
Class CodeSourceURLHandler

java.lang.Object
  extended byissrg.pba.rbac.URLHandler
      extended byissrg.jaas.CodeSourceURLHandler

public class CodeSourceURLHandler
extends URLHandler

This URLHandler knows how to create Principals and Subtrees from a given codesource: URL. The URL is a string of the following format:

codesource:<URL>

The URL is a string with the same semantics as specified in java.security.CodeSource.implies method. Basically, it is a URL where the code is located. It may contain two kinds of wildcards at the end: "-" or "*", which are interpreted as "any file in any subdirectory" or "any file in this subdirectory" respectively; Min and Max level specifications are ignored in this case. If the URL does not end with these wildcards, the PERMIS URLHandler is used to construct the subtree for this URL and Min and Max levels specifications are taken into account.

Java specification allows to specify the signers of the code as well, but this is not supported in the CodeSource URL yet.


Field Summary
static java.lang.String CODE_SOURCE_PROTOCOL
           
 
Fields inherited from class issrg.pba.rbac.URLHandler
defaultPort, FILE_PORT, FILE_PROTOCOL, HTTP_PORT, HTTP_PROTOCOL, HTTPS_PORT, HTTPS_PROTOCOL, protocol
 
Constructor Summary
CodeSourceURLHandler()
           
 
Method Summary
 int getDefaultPort()
          This method returns the number of the defaul port that the protocol listens on
 Entry getEntry(java.lang.String url)
          This method returns an Entry identified by a given HTTP URL.
 Principal getPrincipal(java.lang.String url)
          This method returns a Principal for a given HTTP URL string.
 java.lang.String getProtocol()
          This method returns the string name of the protocol (without the trailing colon).
 AttributeRepository getRepository(java.lang.String url)
          This method returns an instance of a repository that would be able to retrieve attributes given the URL.
 Subtree getSubtree(java.lang.String url, int min, int max, Subtree[] exclude)
           
 
Methods inherited from class issrg.pba.rbac.URLHandler
addProtocol, getEntryByURL, getPrincipalByURL, getProtocolName, getRepositoryByURL, getSubtree, getSubtreeByURL, getURLHandler, removeProtocol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODE_SOURCE_PROTOCOL

public static final java.lang.String CODE_SOURCE_PROTOCOL
See Also:
Constant Field Values
Constructor Detail

CodeSourceURLHandler

public CodeSourceURLHandler()
Method Detail

getProtocol

public java.lang.String getProtocol()
Description copied from class: URLHandler
This method returns the string name of the protocol (without the trailing colon). The protocol is in lowercase letters.

Overrides:
getProtocol in class URLHandler
Returns:
string name of the protocol in lowercase characters

getRepository

public AttributeRepository getRepository(java.lang.String url)
Description copied from class: URLHandler
This method returns an instance of a repository that would be able to retrieve attributes given the URL. Some Repositories may use only the host part of the URL to connect to the server, ignoring the path part.

In this version of the URLHandler, no HTTP/HTTPS repositories are implemented, so null is returned for such URLs.

Overrides:
getRepository in class URLHandler
Parameters:
url - - the URL of the repository
Returns:
the AttributeRepository

getDefaultPort

public int getDefaultPort()
Description copied from class: URLHandler
This method returns the number of the defaul port that the protocol listens on

Overrides:
getDefaultPort in class URLHandler
Returns:
integer number of the port on which the protocol listens by default

getPrincipal

public Principal getPrincipal(java.lang.String url)
                       throws BadURLException
Description copied from class: URLHandler
This method returns a Principal for a given HTTP URL string. It checks if the passed URL string matches the protocol this Handler is registered for.

Overrides:
getPrincipal in class URLHandler
Parameters:
url - the string representation of the HTTP URL (including the protocol name part) (the actual protocol name is checked with the string returned by getProtocol, but the format of the rest of the URL is as specified in HTTP RFC)
Returns:
Principal of the corresponding URL
Throws:
BadURLException

getEntry

public Entry getEntry(java.lang.String url)
               throws BadURLException
Description copied from class: URLHandler
This method returns an Entry identified by a given HTTP URL.

This URLHandler does (Entry)getPrincipal(url) - so if your Principal implements the Entry interface, you can leave the getEntry method.

Overrides:
getEntry in class URLHandler
Parameters:
url - the string representation of the HTTP URL (see comments for getPrincipal method)
Returns:
Entry identified by the URL
Throws:
BadURLException

getSubtree

public Subtree getSubtree(java.lang.String url,
                          int min,
                          int max,
                          Subtree[] exclude)
                   throws BadURLException
Overrides:
getSubtree in class URLHandler
Parameters:
url - the URL of the Base Entry; port may be specified as a range of ports by using nn-mm notation (two numbers separated by hyphen); if no port is specified, any port matches the subtree specification
min - the Min value for the subtree
max - the Max value for the subtree
Throws:
BadURLException
See Also:
Subtree