Style Intelligence v12.0

inetsoft.sree.security
Class SRPrincipal

java.lang.Object
  extended by inetsoft.uql.XPrincipal
      extended by inetsoft.sree.security.SRPrincipal
All Implemented Interfaces:
inetsoft.util.LogPrincipal, Serializable, Cloneable, Principal

public class SRPrincipal
extends XPrincipal
implements Serializable, inetsoft.util.LogPrincipal

This class implements java.security.Principal to represent any entity, such as an individual, a corporation, and a login id. It wraps the user id and a secure id, which is a secure random number

See Also:
Serialized Form

Field Summary
 
Fields inherited from class inetsoft.uql.XPrincipal
ADMIN, ADMINISTRATOR, ADMINISTRATOR_R, ALIAS, ANONYMOUS, EVERYONE, groups, LOCALE, name, params, prop, roles, sessionID
 
Constructor Summary
SRPrincipal()
          Construct a SRPrincipal instance
SRPrincipal(ClientInfo client, String[] roles, long secureID)
          Construct a SRPrincipal instance
SRPrincipal(ClientInfo client, String[] roles, String[] groups, long secureID)
          Construct a SRPrincipal instance
SRPrincipal(ClientInfo client, String[] roles, String[] groups, long secureID, String alias)
          Construct a SRPrincipal instance
SRPrincipal(String user)
          Construct a SRPrincipal instance
SRPrincipal(String user, String[] roles, long secureID)
          Construct a SRPrincipal instance
SRPrincipal(String user, String[] roles, String[] groups, long secureID)
          Construct a SRPrincipal instance
 
Method Summary
 Object clone()
          Clone the object.
static SRPrincipal createFromID(String id)
          Create the principal for the given identifier.
 boolean equals(Object another)
          Compares this principal to the specified object.
 long getAge()
          Return the age in milliseconds since January 1, 1970, 00:00:00 GMT of the SRPrincipal object
 String getClientUserName()
          Return the login name of this principal.
 String getFullName()
          Get the full identifier of this specified user (ip, session, etc.)
 long getLastAccess()
          Return the last access time in milliseconds since January 1, 1970, 00:00:00 GMT of the SRPrincipal object
 Locale getLocale()
          Get the locale.
 String getName()
          Returns the name of this principal.
static String getNameFromID(String id)
          Get the principal name for the given identifier.
 long getSecureID()
          Return the secureID of this SRPrincipal
 Object getSession()
          Get the session object.
 ClientInfo getUser()
          Returns the client info.
 int hashCode()
          Returns a hashcode for this SRPrincipal.
 boolean isValid()
          Check if this principal is valid.
protected  void parseRolesXML(Element elem)
          Parses the user's roles from an XML representation.
 void parseXML(Element elem)
          Parse xml element representation.
 void setLastAccess(long accessed)
          Set last access time.
 void setLocale(Locale locale)
          Set the locale.
 void setSession(Object session)
          Set the session object.
 String toString()
          Returns a string representation of this SRPrincipal.
 void writeXML(PrintWriter writer)
          Write xml element representation to a print writer.
 
Methods inherited from class inetsoft.uql.XPrincipal
addr, copyRoleGroups, getAlias, getGroups, getProperty, getPropertyNames, getRoles, getSessionID, isAdmin, isAdmin, isIgnoreLogin, setAdmin, setAlias, setGroups, setIgnoreLogin, setProperty, setRoles, toView
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SRPrincipal

public SRPrincipal()
Construct a SRPrincipal instance


SRPrincipal

public SRPrincipal(String user)
Construct a SRPrincipal instance

Parameters:
user - the client information of the user.

SRPrincipal

public SRPrincipal(String user,
                   String[] roles,
                   long secureID)
Construct a SRPrincipal instance

Parameters:
user - the client information of the user.
roles - roles assigned to the user.
secureID - a secure random number.

SRPrincipal

public SRPrincipal(String user,
                   String[] roles,
                   String[] groups,
                   long secureID)
Construct a SRPrincipal instance

Parameters:
user - the client information of the user.
roles - roles assigned to the user.
groups - groups the user belongs to.
secureID - a secure random number.

SRPrincipal

public SRPrincipal(ClientInfo client,
                   String[] roles,
                   long secureID)
Construct a SRPrincipal instance

Parameters:
client - the client information of the user.
roles - roles assigned to the user.
secureID - a secure random number.

SRPrincipal

public SRPrincipal(ClientInfo client,
                   String[] roles,
                   String[] groups,
                   long secureID)
Construct a SRPrincipal instance

Parameters:
client - the client information of the user.
roles - roles assigned to the user.
groups - groups the user belongs to.
secureID - a secure random number.

SRPrincipal

public SRPrincipal(ClientInfo client,
                   String[] roles,
                   String[] groups,
                   long secureID,
                   String alias)
Construct a SRPrincipal instance

Parameters:
client - the client information of the user.
roles - roles assigned to the user.
groups - groups the user belongs to.
secureID - a secure random number.
Method Detail

getNameFromID

public static String getNameFromID(String id)
Get the principal name for the given identifier.


createFromID

public static SRPrincipal createFromID(String id)
Create the principal for the given identifier.


equals

public boolean equals(Object another)
Compares this principal to the specified object. Returns true if the object passed in matches the principal represented by the implementation of this interface.

Specified by:
equals in interface Principal
Overrides:
equals in class XPrincipal
Parameters:
another - principal to compare with.
Returns:
true if the principal passed in is the same as that encapsulated by SRPrincipal, and false otherwise.

hashCode

public int hashCode()
Returns a hashcode for this SRPrincipal.

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class XPrincipal
Returns:
a hashcode for this SRPrincipal.

getName

public String getName()
Returns the name of this principal.

Specified by:
getName in interface Principal
Overrides:
getName in class XPrincipal
Returns:
the name of this principal, it may be an empty string if no security is provided.

getClientUserName

public String getClientUserName()
Return the login name of this principal.

Specified by:
getClientUserName in interface inetsoft.util.LogPrincipal

getUser

public ClientInfo getUser()
Returns the client info.


getSecureID

public long getSecureID()
Return the secureID of this SRPrincipal

Returns:
the secureID of this SRPrincipal

getAge

public long getAge()
Return the age in milliseconds since January 1, 1970, 00:00:00 GMT of the SRPrincipal object

Returns:
the age in milliseconds of the SRPrincipal object

setLastAccess

public void setLastAccess(long accessed)
Set last access time.

Parameters:
accessed - the specified last access time.

getLastAccess

public long getLastAccess()
Return the last access time in milliseconds since January 1, 1970, 00:00:00 GMT of the SRPrincipal object

Returns:
last access time in milliseconds of the SRPrincipal object

toString

public String toString()
Returns a string representation of this SRPrincipal.

Specified by:
toString in interface Principal
Overrides:
toString in class XPrincipal
Returns:
a string representation of this object.

getFullName

public String getFullName()
Get the full identifier of this specified user (ip, session, etc.)

Overrides:
getFullName in class XPrincipal

clone

public Object clone()
Clone the object.

Overrides:
clone in class XPrincipal

writeXML

public void writeXML(PrintWriter writer)
Write xml element representation to a print writer.

Overrides:
writeXML in class XPrincipal
Parameters:
writer - the specified print writer

parseXML

public void parseXML(Element elem)
              throws Exception
Parse xml element representation.

Overrides:
parseXML in class XPrincipal
Parameters:
elem - the specified xml element representation
Throws:
Exception

parseRolesXML

protected void parseRolesXML(Element elem)
                      throws Exception
Parses the user's roles from an XML representation.

Parameters:
elem - the DOM element representing the user's roles.
Throws:
Exception - if the DOM element could not be parsed.

getLocale

public Locale getLocale()
Get the locale.


setLocale

public void setLocale(Locale locale)
Set the locale.


setSession

public void setSession(Object session)
Set the session object.


getSession

public Object getSession()
Get the session object.


isValid

public boolean isValid()
Check if this principal is valid.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.