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

public Class HTAccessHandler

extends ConstraintsSecurityHandler
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.security.Principal, java.util.ArrayList, .HashMap, .HashSet, .Map, .StringTokenizer, javax.servlet.ServletException, javax.servlet.http.HttpServletRequest, .HttpServletResponse, org.mortbay.jetty.Handler, .HttpConnection, .HttpHeaders, .Request, .Response, .UserRealm, org.mortbay.jetty.handler.ContextHandler, org.mortbay.log.Log, .Logger, org.mortbay.resource.Resource, org.mortbay.util.StringUtil, .URIUtil

Handler to authenticate access using the Apache's .htaccess files.
Authors
Van den Broeke Iris, Deville Daniel, Dubois Roger, Greg Wilkins, Konstantin Metlov

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
HTAccessHandler.DummyPrincipal

DummyPrincipal For use when there is no user realm configured.

private static class

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv String
pack-priv transient HashMap<K, V>
private static Logger
private Handler
Inherited from org.mortbay.jetty.security.ConstraintsSecurityHandler:
__NO_USER

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Principal
getPrincipal(String user, UserRealm realm)

Get a Principal matching the user.

protected Handler

Returns:

Returns the protegee.
getProtegee
()

Getter for property protegee.

public void
handle(String
The target of the request - either a URI or a name.
target
,
HttpServletRequest
The request either as the Request object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Request object if required.
request
,
HttpServletResponse
The response as the Response object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Response object if required.
response
,
int
The dispatch mode: REQUEST, FORWARD, INCLUDE, ERROR
dispatch
)

Overrides org.mortbay.jetty.security.ConstraintsSecurityHandler.handle.

Implements org.mortbay.jetty.Handler.handle.

Handle a request.
public void
public void
setDefault(String dir)

set functions for the following .xml administration statements.</set></set></new></arg></call>

public void
setProtegee(Handler
The protegee to set.
protegee
)

Setter for property protegee.

Inherited from org.mortbay.jetty.security.ConstraintsSecurityHandler:
checkSecurityConstraintsdoStartgetAuthenticatorgetAuthMethodgetConstraintMappingsgetUserRealmhasConstraintsisCheckWelcomeFilessetAuthenticatorsetAuthMethodsetCheckWelcomeFilessetConstraintMappingssetUserRealm

Field Detail

_accessFileback to summary
pack-priv String _accessFile
_defaultback to summary
pack-priv String _default
_htCacheback to summary
pack-priv transient HashMap<K, V> _htCache
logback to summary
private static Logger log
protegeeback to summary
private Handler protegee

Constructor Detail

HTAccessHandlerback to summary
public HTAccessHandler()

Method Detail

getPrincipalback to summary
public Principal getPrincipal(String user, UserRealm realm)

Get a Principal matching the user. If there is no user realm, and therefore we are using a htpassword file instead, then just return a dummy Principal.

getProtegeeback to summary
protected Handler getProtegee()

Getter for property protegee.

Returns:Handler

Returns the protegee.

handleback to summary
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException

Overrides org.mortbay.jetty.security.ConstraintsSecurityHandler.handle.

Implements org.mortbay.jetty.Handler.handle.

Doc from org.mortbay.jetty.Handler.handle.

Handle a request.

Parameters
target:String

The target of the request - either a URI or a name.

request:HttpServletRequest

The request either as the Request object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Request object if required.

response:HttpServletResponse

The response as the Response object or a wrapper of that request. The HttpConnection#getCurrentConnection() method can be used access the Response object if required.

dispatch:int

The dispatch mode: REQUEST, FORWARD, INCLUDE, ERROR

See Also
org.mortbay.jetty.Handler#handle(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
setAccessFileback to summary
public void setAccessFile(String anArg)
setDefaultback to summary
public void setDefault(String dir)

set functions for the following .xml administration statements. ./etc/htaccess .htaccess

setProtegeeback to summary
public void setProtegee(Handler protegee)

Setter for property protegee.

Parameters
protegee:Handler

The protegee to set.

org.mortbay.jetty.security back to summary

pack-priv Class HTAccessHandler.DummyPrincipal

extends Object
implements Principal
Class Inheritance
All Implemented Interfaces
java.security.Principal

DummyPrincipal For use when there is no user realm configured.

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements java.security.Principal.getName.

Returns the name of this Principal.
public String
toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Returns a string representation of this Principal.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_userNameback to summary
private String _userName

Constructor Detail

DummyPrincipalback to summary
public DummyPrincipal(String name)

Method Detail

getNameback to summary
public String getName()

Implements java.security.Principal.getName.

Doc from java.security.Principal.getName.

Returns the name of this Principal.

Returns:String

the name of this Principal.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Doc from java.security.Principal.toString.

Returns a string representation of this Principal.

Returns:String

a string representation of this Principal.

org.mortbay.jetty.security back to summary

private Class HTAccessHandler.HTAccess

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv ArrayList<E>
pack-priv ArrayList<E>
pack-priv boolean
pack-priv String
pack-priv long
pack-priv Resource
pack-priv HashMap<K, V>
pack-priv long
pack-priv HashMap<K, V>
pack-priv String
pack-priv int
pack-priv HashSet<E>
pack-priv String
pack-priv int
pack-priv String
pack-priv String
pack-priv long
pack-priv Resource
pack-priv HashMap<K, V>
pack-priv static final int
pack-priv static final int
pack-priv static final String
pack-priv static final String
pack-priv static final String

Constructor Summary

AccessConstructor and Description
public
HTAccess(Resource resource)

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
checkAuth(String user, String pass, UserRealm realm, Request request)

public Resource
public long
public HashMap<K, V>
public String
public int
public String
private String
private ArrayList<E>
public Resource
public boolean
public boolean
public boolean
private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_allowListback to summary
pack-priv ArrayList<E> _allowList
_denyListback to summary
pack-priv ArrayList<E> _denyList
_forbiddenback to summary
pack-priv boolean _forbidden
_groupFileback to summary
pack-priv String _groupFile
_groupModifiedback to summary
pack-priv long _groupModified
_groupResourceback to summary
pack-priv Resource _groupResource
_groupsback to summary
pack-priv HashMap<K, V> _groups
_lastModifiedback to summary
pack-priv long _lastModified
_methodsback to summary
pack-priv HashMap<K, V> _methods
_nameback to summary
pack-priv String _name
_orderback to summary
pack-priv int _order
_requireEntitiesback to summary
pack-priv HashSet<E> _requireEntities
_requireNameback to summary
pack-priv String _requireName
_satisfyback to summary
pack-priv int _satisfy
_typeback to summary
pack-priv String _type
_userFileback to summary
pack-priv String _userFile
_userModifiedback to summary
pack-priv long _userModified
_userResourceback to summary
pack-priv Resource _userResource
_usersback to summary
pack-priv HashMap<K, V> _users
ALLback to summary
pack-priv static final int ALL
ANYback to summary
pack-priv static final int ANY
GROUPback to summary
pack-priv static final String GROUP
USERback to summary
pack-priv static final String USER
VALID_USERback to summary
pack-priv static final String VALID_USER

Constructor Detail

HTAccessback to summary
public HTAccess(Resource resource)

Method Detail

checkAccessback to summary
public boolean checkAccess(String host, String ip)
checkAuthback to summary
public boolean checkAuth(String user, String pass, UserRealm realm, Request request)
getGroupResourceback to summary
public Resource getGroupResource()
getLastModifiedback to summary
public long getLastModified()
getMethodsback to summary
public HashMap<K, V> getMethods()
getNameback to summary
public String getName()
getSatisfyback to summary
public int getSatisfy()
getTypeback to summary
public String getType()
getUserCodeback to summary
private String getUserCode(String user)
getUserGroupsback to summary
private ArrayList<E> getUserGroups(String group)
getUserResourceback to summary
public Resource getUserResource()
isAccessLimitedback to summary
public boolean isAccessLimited()
isAuthLimitedback to summary
public boolean isAuthLimited()
isForbiddenback to summary
public boolean isForbidden()
parseback to summary
private void parse(BufferedReader htin) throws IOException
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