|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.http.auth.JAASAuthenticator
public class JAASAuthenticator
This wrapper forces JAAS authentication to happen at client side: if "Authorization" header is missing it would return 401 code requesting one. This class performs only basic http authentication.
When user is authenticated Subject
object is placed in the user session
under AUTHORIZATION_DATA_ATTRIBUTE
name. That is only going to happen if
session manager is passed to this object.
Nested Class Summary | |
---|---|
protected class |
JAASAuthenticator.AuthData
Class holding cached authorisation data |
Field Summary | |
---|---|
static String |
AUTHORIZATION_DATA_ATTRIBUTE
Authorisation data session attribute |
static String |
AUTHORIZATION_REQUEST_HEADER
Client request header for authorisation |
static String |
AUTHORIZATION_RESPONSE_HEADER
Server response header for authorisation |
protected Map<String,JAASAuthenticator.AuthData> |
cachedAuth
Cache to hold authorisation information for a while |
protected int |
cacheTimeout
Cache timeout |
static int |
DEFAULT_CACHE_TIMEOUT
Default cache timeout |
static int |
DEFAULT_MINIMUM_SCAN_PERIOD
Default minimum scan period |
protected ConnectionHandler |
handler
Wrapped handler |
protected long |
lastScan
When was cache scanned last time for expired entries |
protected org.slf4j.Logger |
logger
Logger |
protected LoginContext |
loginContext
Login context |
protected String |
loginContextName
Login context name |
protected int |
minScanPeriod
Minimum scan period |
protected String |
realm
Realm name |
protected HTTPSessionManager |
sessionManager
Session manager |
Constructor Summary | |
---|---|
JAASAuthenticator()
Constructor |
|
JAASAuthenticator(ConnectionHandler handler)
Constructor |
Method Summary | |
---|---|
protected Subject |
authorise(String base64)
Obtains subject object from base 64 encoded username and password |
int |
getCacheTimeout()
Returns cache timeout |
ConnectionHandler |
getHandler()
Returns wrapped handler |
LoginContext |
getLoginContext()
Returns login context |
String |
getLoginContextName()
Returns login context name |
int |
getMinimumScanPeriod()
Return minimum scan period |
String |
getRealm()
Returns realm to be used. |
HTTPSessionManager |
getSessionManager()
Returns session manaager |
void |
handleConnection(Connection connection)
This method creates sets context path to be same as context path up to here plus this component's path. |
void |
setCacheTimeout(int cacheTimeout)
Sets cache timeout |
void |
setHandler(ConnectionHandler handler)
Sets wrapped handler |
void |
setLoginContext(LoginContext loginContext)
Sets login context |
void |
setLoginContextName(String loginContextName)
Sets login context name |
void |
setMinimumScanPeriod(int minScanPeriod)
Sets minimum scan period |
void |
setRealm(String realm)
Sets realm. |
void |
setSessionManager(HTTPSessionManager sessionManager)
Sets session manager |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.slf4j.Logger logger
public static final String AUTHORIZATION_DATA_ATTRIBUTE
public static final String AUTHORIZATION_REQUEST_HEADER
public static final String AUTHORIZATION_RESPONSE_HEADER
public static final int DEFAULT_CACHE_TIMEOUT
public static final int DEFAULT_MINIMUM_SCAN_PERIOD
protected ConnectionHandler handler
protected HTTPSessionManager sessionManager
protected String realm
protected String loginContextName
protected LoginContext loginContext
protected Map<String,JAASAuthenticator.AuthData> cachedAuth
protected int cacheTimeout
protected int minScanPeriod
protected long lastScan
Constructor Detail |
---|
public JAASAuthenticator()
public JAASAuthenticator(ConnectionHandler handler)
Method Detail |
---|
public void handleConnection(Connection connection) throws ConnectionException
/"
- Specified by:
handleConnection
in interface ConnectionHandler
- Parameters:
connection
- socket connection
- Throws:
ConnectionException
protected Subject authorise(String base64)
base64
- base 64 encoded username and password
null
public ConnectionHandler getHandler()
public void setHandler(ConnectionHandler handler)
handler
- wrapped handlerpublic HTTPSessionManager getSessionManager()
public void setSessionManager(HTTPSessionManager sessionManager)
sessionManager
- http session managerpublic String getRealm()
public void setRealm(String realm)
realm
- realmpublic String getLoginContextName()
public void setLoginContextName(String loginContextName)
loginContextName
- login context namepublic LoginContext getLoginContext()
public void setLoginContext(LoginContext loginContext)
loginContext
- login contextpublic int getCacheTimeout()
public void setCacheTimeout(int cacheTimeout)
cacheTimeout
- cache timeoutpublic int getMinimumScanPeriod()
public void setMinimumScanPeriod(int minScanPeriod)
minScanPeriod
- minimum scan period
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |