com.sap.engine.lib.security

Class Principal

java.lang.Object
  extended by com.sap.engine.lib.security.Principal
All Implemented Interfaces:
Serializable, Principal

public class Principal
extends Object
implements Principal, Serializable

This class identifies the authenticated user in all containers. For example, it can be obtained from Web Container, by calling HttpServletRequest's method getUserPrincipal().

See Also:
Serialized Form

Field Summary
static String AUTH_METHOD_CERTIFICATE
           
static String AUTH_METHOD_DIGEST
           
static String AUTH_METHOD_HEADER_VARIABLE
           
static String AUTH_METHOD_PASSWORD
           
static String AUTH_METHOD_SAML_ARTIFACT
           
static String AUTH_METHOD_SAP_ASSERTION_TICKET
           
static String AUTH_METHOD_SAP_LOGON_TICKET
           
static String AUTH_METHOD_UNKNOWN
           
static String AUTH_METHOD_WSSEC_SAML
           
 
Constructor Summary
Principal(String name)
          This constructs new Principal by given name.
 
Method Summary
 boolean equals(Object alien)
          Compares this principal to the specified object.
 String getAuthenticationMethod()
          Returns the authentication method that was used to authenticate this principal.
 String getName()
          Returns the name of this principal.
 int hashCode()
          Returns a hashcode for this principal.
 void setAuthenticationMethod(String authenticationMethod)
          Specifies the authentication method that was used to create this principal.
 String toString()
          Returns a string representation of this principal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTH_METHOD_UNKNOWN

public static final String AUTH_METHOD_UNKNOWN
See Also:
Constant Field Values

AUTH_METHOD_PASSWORD

public static final String AUTH_METHOD_PASSWORD
See Also:
Constant Field Values

AUTH_METHOD_DIGEST

public static final String AUTH_METHOD_DIGEST
See Also:
Constant Field Values

AUTH_METHOD_CERTIFICATE

public static final String AUTH_METHOD_CERTIFICATE
See Also:
Constant Field Values

AUTH_METHOD_SAP_LOGON_TICKET

public static final String AUTH_METHOD_SAP_LOGON_TICKET
See Also:
Constant Field Values

AUTH_METHOD_SAP_ASSERTION_TICKET

public static final String AUTH_METHOD_SAP_ASSERTION_TICKET
See Also:
Constant Field Values

AUTH_METHOD_SAML_ARTIFACT

public static final String AUTH_METHOD_SAML_ARTIFACT
See Also:
Constant Field Values

AUTH_METHOD_WSSEC_SAML

public static final String AUTH_METHOD_WSSEC_SAML
See Also:
Constant Field Values

AUTH_METHOD_HEADER_VARIABLE

public static final String AUTH_METHOD_HEADER_VARIABLE
See Also:
Constant Field Values
Constructor Detail

Principal

public Principal(String name)
This constructs new Principal by given name.

Parameters:
name - is the authenticated user's username.
Method Detail

equals

public boolean equals(Object alien)
Compares this principal to the specified object. Returns true if two compared principals have the same name.

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
another - principal to compare with.
Returns:
true if the principal passed in has the same name as that encapsulated by this principal's name, and false otherwise.

getName

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

Specified by:
getName in interface Principal
Returns:
the name of this principal.

hashCode

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

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
a hashcode for this principal.

toString

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

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

setAuthenticationMethod

public void setAuthenticationMethod(String authenticationMethod)
Specifies the authentication method that was used to create this principal. Using this method is useful only for principals that are the result of an authentication.

Parameters:
authenticationMethod - One of the constants AUTH_METHOD_... of this class. The parameter is of type String to allow setting custom type authentication methods, although the SAP code might recognize only the constant values.

getAuthenticationMethod

public String getAuthenticationMethod()
Returns the authentication method that was used to authenticate this principal.

Returns:
A String with the authentication method as set by the login module that added this principal. For the common methods, constants AUTH_METHOD_... are provided in this class. Comparing the result of this method with one of the constants must be done using the equals() method, not by ==.
Access Rights

This class can be accessed from:


SC DC
[sap.com] SAP_BUILDT [sap.com] tc/bi/wstech
[sap.com] ENGINEAPI [sap.com] webservices_lib
[sap.com] ENGFACADE [sap.com] tc/je/security/api
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib


Copyright 2010 SAP AG Complete Copyright Notice