Top Description Inners Fields Constructors Methods
org.mortbay.jetty.security

public Class FormAuthenticator

extends Object
implements Authenticator
Class Inheritance
All Implemented Interfaces
org.mortbay.jetty.Authenticator, java.io.Serializable
Imports
java.io.IOException, .Serializable, java.security.Principal, javax.servlet.http.HttpServletRequest, .HttpServletResponse, .HttpSession, .HttpSessionBindingEvent, .HttpSessionBindingListener, org.mortbay.jetty.Authenticator, .Request, .Response, .UserRealm, org.mortbay.log.Log, org.mortbay.util.StringUtil, .URIUtil

FORM Authentication Authenticator. The HTTP Session is used to store the authentication status of the user, which can be distributed. If the realm implements SSORealm, SSO is supported.
Authors
Greg Wilkins (gregw), [email protected]

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
FormAuthenticator.FormCredential

FORM Authentication credential holder.

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
public static final String
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Principal

Returns:

UserPrincipal if authenticated else null.
authenticate
(UserRealm
an UserRealm value
realm
,
String
a String value
pathInContext
,
Request
a Request value
request
,
Response
a Response value. If non-null response is passed, then a failed authentication will result in a challenge response being set in the response.
response
)

Implements org.mortbay.jetty.Authenticator.authenticate.

Perform form authentication.
public String
public String
public String
public boolean
isLoginOrErrorPage(String pathInContext)

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

__J_AUTHENTICATEDback to summary
public static final String __J_AUTHENTICATED
__J_PASSWORDback to summary
public static final String __J_PASSWORD
__J_SECURITY_CHECKback to summary
public static final String __J_SECURITY_CHECK
__J_URIback to summary
public static final String __J_URI
__J_USERNAMEback to summary
public static final String __J_USERNAME
_formErrorPageback to summary
private String _formErrorPage
_formErrorPathback to summary
private String _formErrorPath
_formLoginPageback to summary
private String _formLoginPage
_formLoginPathback to summary
private String _formLoginPath

Constructor Detail

FormAuthenticatorback to summary
public FormAuthenticator()

Method Detail

authenticateback to summary
public Principal authenticate(UserRealm realm, String pathInContext, Request request, Response response) throws IOException

Implements org.mortbay.jetty.Authenticator.authenticate.

Perform form authentication. Called from SecurityHandler.

Parameters
realm:UserRealm

Doc from org.mortbay.jetty.Authenticator.authenticate.

an UserRealm value

pathInContext:String

Doc from org.mortbay.jetty.Authenticator.authenticate.

a String value

request:Request

Doc from org.mortbay.jetty.Authenticator.authenticate.

a Request value

response:Response

Doc from org.mortbay.jetty.Authenticator.authenticate.

a Response value. If non-null response is passed, then a failed authentication will result in a challenge response being set in the response.

Returns:Principal

UserPrincipal if authenticated else null.

Exceptions
IOException:

Doc from org.mortbay.jetty.Authenticator.authenticate.

if an error occurs

getAuthMethodback to summary
public String getAuthMethod()

Implements org.mortbay.jetty.Authenticator.getAuthMethod.

getErrorPageback to summary
public String getErrorPage()
getLoginPageback to summary
public String getLoginPage()
isLoginOrErrorPageback to summary
public boolean isLoginOrErrorPage(String pathInContext)
setErrorPageback to summary
public void setErrorPage(String path)
setLoginPageback to summary
public void setLoginPage(String path)
org.mortbay.jetty.security back to summary

private Class FormAuthenticator.FormCredential

extends Object
implements Serializable, HttpSessionBindingListener
Class Inheritance
All Implemented Interfaces
javax.servlet.http.HttpSessionBindingListener, java.util.EventListener, java.io.Serializable

FORM Authentication credential holder.

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv String
pack-priv transient UserRealm
pack-priv transient Principal

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
authenticate(UserRealm realm, String user, String password, Request request)

pack-priv void
authenticate(UserRealm realm, Request request)

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
valueBound(HttpSessionBindingEvent
the event that identifies the session
event
)

Overrides default javax.servlet.http.HttpSessionBindingListener.valueBound.

Notifies the object that it is being bound to a session and identifies the session.
public void
valueUnbound(HttpSessionBindingEvent
the event that identifies the session
event
)

Overrides default javax.servlet.http.HttpSessionBindingListener.valueUnbound.

Notifies the object that it is being unbound from a session and identifies the session.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

_jPasswordback to summary
pack-priv String _jPassword
_jUserNameback to summary
pack-priv String _jUserName
_realmback to summary
pack-priv transient UserRealm _realm
_userPrincipalback to summary
pack-priv transient Principal _userPrincipal

Constructor Detail

FormCredentialback to summary
private FormCredential()

Method Detail

authenticateback to summary
pack-priv void authenticate(UserRealm realm, String user, String password, Request request)
authenticateback to summary
pack-priv void authenticate(UserRealm realm, Request request)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

valueBoundback to summary
public void valueBound(HttpSessionBindingEvent event)

Overrides default javax.servlet.http.HttpSessionBindingListener.valueBound.

Doc from javax.servlet.http.HttpSessionBindingListener.valueBound.

Notifies the object that it is being bound to a session and identifies the session.

Parameters
event:HttpSessionBindingEvent

the event that identifies the session

valueUnboundback to summary
public void valueUnbound(HttpSessionBindingEvent event)

Overrides default javax.servlet.http.HttpSessionBindingListener.valueUnbound.

Doc from javax.servlet.http.HttpSessionBindingListener.valueUnbound.

Notifies the object that it is being unbound from a session and identifies the session.

Parameters
event:HttpSessionBindingEvent

the event that identifies the session