no.feide.moria.authorization
Class AuthorizationClient

java.lang.Object
  extended by no.feide.moria.authorization.AuthorizationClient

final class AuthorizationClient
extends java.lang.Object

Represents a web service. A web service has a name, id, url and attributes. The attributes are flattened (for optimization) from a set of profiles, allowed and denied attributes.


Field Summary
private  java.util.HashSet affiliation
          The organizations that the service belongs to.
private  java.util.HashMap attributes
          Attributes the client can query.
private  java.lang.String displayName
          Common name of the service.
private  int hashCode
          Cached hash code.
private  java.lang.String home
          The organization the webservice sets as default.
private  java.lang.String language
          Language preferred by the web service.
private  no.feide.moria.log.MessageLogger log
          Used for logging.
private  java.lang.String name
          Unique identifier (principal) for the client.
private  java.util.HashSet operations
          The operations the client can perform.
private  java.util.HashSet orgsAllowed
          The organizations that can use the service.
private  java.util.HashMap properties
          The properties of this object.
private  java.util.HashSet subsystems
          The subsystems the client can use proxy authentication for.
private  java.lang.String url
          Home page URL for web service.
 
Constructor Summary
AuthorizationClient(java.lang.String name, java.lang.String displayName, java.lang.String url, java.lang.String language, java.lang.String home, java.util.HashSet affiliation, java.util.HashSet orgsAllowed, java.util.HashSet operations, java.util.HashSet subsystems, java.util.HashMap attributes)
          Constructor.
 
Method Summary
(package private)  boolean allowAccessTo(java.lang.String[] requestedAttributes)
          Checks if all the requested attributes are legal for this web service.
(package private)  boolean allowOperations(java.lang.String[] requestedOperations)
          Returns true if all elements in the requestedOperations array are represented in the objects operations set.
(package private)  boolean allowSSOForAttributes(java.lang.String[] requestedAttributes)
          Checks attributes for use with single sign-on (SSO).
(package private)  boolean allowSubsystems(java.lang.String[] requestedSubsystems)
          Used to decide whether subsystems are allowed for this particular client, based on its configuration.
(package private)  boolean allowUserorg(java.lang.String organization)
          Returns true for the organizations that are allowed to use this service.
 boolean equals(java.lang.Object object)
          Compares object with another, returnes true if all fields are equal.
(package private)  java.util.HashSet getAffiliation()
          Returns the affiliation for this client.
(package private)  java.util.HashMap getAttributes()
          Returns the attributes for this client.
 java.lang.String getDisplayName()
          Returns the display name for this client.
 java.lang.String getHome()
          Returns the home organization for this client.
 java.lang.String getLanguage()
          Returns the language for this client.
 java.lang.String getName()
          Returns the principal of this client.
protected  java.lang.String[] getNonSSOAttributeNames()
          Get the attributes not allowed for use in an SSO context for this client.
(package private)  java.util.HashSet getOperations()
          Returns the operations for this client.
(package private)  java.util.HashSet getOrgsAllowed()
          Returns the organizations that are allowed to use the client.
 java.util.HashMap getProperties()
          Gets the properties for this client.
(package private)  int getSecLevel(java.lang.String[] requestedAttributes)
          Returns the highest secLevel of the requested attributes.
(package private)  java.util.HashSet getSubsystems()
          Returns the subsystems for this client, if any are defined.
 java.lang.String getURL()
          Returns the URL for this client.
(package private)  boolean hasAffiliation(java.lang.String organization)
          Returns true if the supplied organization name is affiliated with the client.
 int hashCode()
          Generate a hash code for the object.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private final no.feide.moria.log.MessageLogger log
Used for logging.


hashCode

private volatile int hashCode
Cached hash code.


name

private final java.lang.String name
Unique identifier (principal) for the client.


displayName

private final java.lang.String displayName
Common name of the service.


url

private final java.lang.String url
Home page URL for web service. Used for creating hyperlinks (together with the name of the web service).


language

private final java.lang.String language
Language preferred by the web service.


home

private final java.lang.String home
The organization the webservice sets as default. Typically this is set to the organization that the web service belongs to.


affiliation

private final java.util.HashSet affiliation
The organizations that the service belongs to.


orgsAllowed

private final java.util.HashSet orgsAllowed
The organizations that can use the service.


operations

private final java.util.HashSet operations
The operations the client can perform.


subsystems

private final java.util.HashSet subsystems
The subsystems the client can use proxy authentication for.


attributes

private final java.util.HashMap attributes
Attributes the client can query.


properties

private final java.util.HashMap properties
The properties of this object. Used to transport internal data outside of the package.

Constructor Detail

AuthorizationClient

AuthorizationClient(java.lang.String name,
                    java.lang.String displayName,
                    java.lang.String url,
                    java.lang.String language,
                    java.lang.String home,
                    java.util.HashSet affiliation,
                    java.util.HashSet orgsAllowed,
                    java.util.HashSet operations,
                    java.util.HashSet subsystems,
                    java.util.HashMap attributes)
Constructor. Creates a new object describing a Moria service client, used for authorization purposes.

Parameters:
name - serviceID The unique client ID assigned to this service. Cannot be null or an empty string.
displayName - Full name of the service, for display purposes. Cannot be null or an empty string.
url - URL to the service main page, where information on the service should be found. Cannot be null or an empty string.
language - Default language for the service. Must match one of the configured languages. Cannot be null or an empty string.
home - Service home organization. Must match one of the configured organizations. Cannot be null or an empty string.
affiliation - The organizations affiliated to the service. Cannot be null.
orgsAllowed - The organizations that are allowed to use the service. Cannot be null.
operations - Operations that the service can perform. Cannot be null.
subsystems - Subsystems the service can create proxy tickets for. May be null.
attributes - Attributes the service can access. Cannot be null.
Throws:
java.lang.IllegalArgumentException - If any of name,displayName, url,language, home,affiliation, allowedOrg, operations, or attributes are null or an empty string (where applicable).
Method Detail

allowAccessTo

boolean allowAccessTo(java.lang.String[] requestedAttributes)
Checks if all the requested attributes are legal for this web service.

Parameters:
requestedAttributes - Names of all requested attributes.
Returns:
true if access to the attributes is granted, else false.
Throws:
java.lang.IllegalArgumentException - If requestedAttributes is null.

allowSSOForAttributes

boolean allowSSOForAttributes(java.lang.String[] requestedAttributes)
Checks attributes for use with single sign-on (SSO). If all attributes are registered in the web service's attributes list and all attributes are allowed to use with SSO, then so be it.

Parameters:
requestedAttributes - The names of all requested attributes.
Returns:
true if the attributes can be used with SSO, else false.
Throws:
java.lang.IllegalArgumentException - If requestedAttributes is null.

getNonSSOAttributeNames

protected java.lang.String[] getNonSSOAttributeNames()
Get the attributes not allowed for use in an SSO context for this client.

Returns:
An array of attribute names. May be an empty array, but never null.

hasAffiliation

boolean hasAffiliation(java.lang.String organization)
Returns true if the supplied organization name is affiliated with the client.

Parameters:
organization - Name of the organization to match.
Returns:
true if the supplied organization name is affiliated with the client.
Throws:
java.lang.IllegalArgumentException - If organization is null or an empty string.

allowOperations

boolean allowOperations(java.lang.String[] requestedOperations)
Returns true if all elements in the requestedOperations array are represented in the objects operations set.

Parameters:
requestedOperations - A string array of operation names
Returns:
true if all operations are allowed, else false.
Throws:
java.lang.IllegalArgumentException - If requestedOperations is null.

allowUserorg

boolean allowUserorg(java.lang.String organization)
Returns true for the organizations that are allowed to use this service.

Parameters:
organization - The organization requesting authorization.
Returns:
true if the organization can use this service.
Throws:
java.lang.IllegalArgumentException - If organization is null.

allowSubsystems

boolean allowSubsystems(java.lang.String[] requestedSubsystems)
Used to decide whether subsystems are allowed for this particular client, based on its configuration.

Parameters:
requestedSubsystems - A string array of subsystem names. Cannot be null.
Returns:
true if subsystems are allowed, otherwise false.
Throws:
java.lang.IllegalArgumentException - If requestedSubsystems is null.

equals

public boolean equals(java.lang.Object object)
Compares object with another, returnes true if all fields are equal.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare with.
Returns:
true if objects are equal.

hashCode

public int hashCode()
Generate a hash code for the object. The hash code is computed from all fields.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object: Name: NAME DisplayName: DISPLAYNAME URL: URL Language: LANGUAGE Home: HOME Affiliations: AFFILIATION Operations: OPERATIONS Attributes: ATTRIBUTES

getURL

public java.lang.String getURL()
Returns the URL for this client.

Returns:
The URL for the main page of the client service.

getName

public java.lang.String getName()
Returns the principal of this client.

Returns:
Client's principal.

getDisplayName

public java.lang.String getDisplayName()
Returns the display name for this client.

Returns:
Name of the client, to be displayed to the user.

getLanguage

public java.lang.String getLanguage()
Returns the language for this client.

Returns:
Language of the client service.

getHome

public java.lang.String getHome()
Returns the home organization for this client.

Returns:
The home organization of the client service.

getAffiliation

java.util.HashSet getAffiliation()
Returns the affiliation for this client.

Returns:
Returns the affiliation.

getOrgsAllowed

java.util.HashSet getOrgsAllowed()
Returns the organizations that are allowed to use the client.

Returns:
The organizations.

getOperations

java.util.HashSet getOperations()
Returns the operations for this client.

Returns:
Returns the operations.

getSubsystems

java.util.HashSet getSubsystems()
Returns the subsystems for this client, if any are defined.

Returns:
A new HashSet object containing the defined subsystems, or null if no subsystems are defined for this client.

getAttributes

java.util.HashMap getAttributes()
Returns the attributes for this client.

Returns:
Returns the attributes.

getProperties

public java.util.HashMap getProperties()
Gets the properties for this client. The properties object contains the data that should be transferred to other packages.

Returns:
The properties for this object.

getSecLevel

int getSecLevel(java.lang.String[] requestedAttributes)
          throws UnknownAttributeException
Returns the highest secLevel of the requested attributes.

Parameters:
requestedAttributes - The requested attributes.
Returns:
The highest of the attributes seclevel, 0 if no attributes are requested.
Throws:
UnknownAttributeException - if one (or more) of the requested attributes are not present in the authorization client.
java.lang.IllegalArgumentException - If requestedAttributes is null.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.