|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweblogic.servlet.security.ServletAuthentication
public final class ServletAuthentication
ServletAuthentication allows both form-based authentication and programmatic authentication in servlets. It performs the authentication call through the Realm and sets the user information into the session. The weak() methods are for password authentication and the strong() methods are for certificate-based authentication. The later being only available through two-way SSL connections, based on the client certificate chain.
Field Summary | |
---|---|
static int |
AUTHENTICATED
Return value of a successful authentication |
static int |
FAILED_AUTHENTICATION
Return value of an unsuccessful authentication |
static int |
NEEDS_CREDENTIALS
Return value of an unsuccessful authentication due to no credentials. |
Constructor Summary | |
---|---|
ServletAuthentication(String usernameField,
String passwordField)
Constructs a ServletAuthentication object which will look for specific form fields inside the HttpRequest for the username and password. |
Method Summary | |
---|---|
static int |
assertIdentity(HttpServletRequest request,
HttpServletResponse response,
String realmName)
Strong authentication using the client-side certificate chain as the credential for authentication. |
static int |
assertIdentity(HttpServletRequest request,
HttpServletResponse response,
String realmName,
AppContext appContext)
Strong authentication using the client-side certificate chain as the credential for authentication. |
static int |
authenticate(CallbackHandler handler,
HttpServletRequest request)
Returns an int value for AUTHENTICATED or FAILED_AUTHENTICATION. |
static int |
authObject(String username,
Object credential,
HttpServletRequest request)
Deprecated. |
static int |
authObject(String username,
Object credential,
HttpSession session,
HttpServletRequest request)
Deprecated. |
static void |
done(HttpServletRequest request)
This "logs out" the user in the session by removing the pertinent data from the sessions the user has logged into and also from the webserver, without losing other session data. |
static void |
generateNewSessionID(HttpServletRequest request)
This moves all current session information into a completely different session ID and re-associate this session with this new ID. |
static Cookie |
getSessionCookie(HttpServletRequest request,
HttpServletResponse response)
This would allow you to get a handle on the session cookie itself. |
static String |
getTargetURIForFormAuthentication(HttpSession session)
This method returns the target URI stored in the first step of Form based authentication. |
static String |
getTargetURLForFormAuthentication(HttpSession session)
This method returns the target URL stored in the first step of Form based authentication. |
static boolean |
invalidateAll(HttpServletRequest req)
Invalidate all the sessions for the current user only (ie. |
static void |
killCookie(HttpServletRequest req)
Kills the current cookie |
static int |
login(CallbackHandler handler,
HttpServletRequest request)
Returns an int value for AUTHENTICATED or FAILED_AUTHENTICATION. |
static int |
login(String username,
String password,
HttpServletRequest request,
HttpServletResponse response)
Returns an int value for AUTHENTICATED or FAILED_AUTHENTICATION after using the username and password to authenticate the user and setting that user information into the session. |
static boolean |
logout(HttpServletRequest req)
This "logs out" the user in the session by removing the pertinent data from the sessions the user has logged into and also from the webserver, without losing other session data. |
static void |
runAs(Subject subject,
HttpServletRequest request)
With a given subject, this method sets the current thread identity and current session identity. |
static int |
strong(HttpServletRequest request,
HttpServletResponse response)
Strong authentication using the client-side certificate chain as the credential for authentication against the "weblogic" (default) realm. |
static int |
strong(HttpServletRequest request,
HttpServletResponse response,
String realmName)
Strong authentication using the client-side certificate chain as the credential for authentication. |
int |
weak(HttpServletRequest request,
HttpServletResponse response)
Returns an int value for AUTHENTICATED or FAILED_AUTHENTICATION after pulling the username and password from the request, authenticating the user and setting it into the session. |
static int |
weak(String username,
String password,
HttpServletRequest request)
Deprecated. since 9.0; use weak(String, String, HttpServletRequest, HttpServletResponse); |
static int |
weak(String username,
String password,
HttpServletRequest request,
HttpServletResponse response)
Returns an int value for AUTHENTICATED or FAILED_AUTHENTICATION after using the username and password to authenticate the user and setting that user information into the session. |
static int |
weak(String username,
String password,
HttpSession session)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int AUTHENTICATED
public static final int FAILED_AUTHENTICATION
public static final int NEEDS_CREDENTIALS
Constructor Detail |
---|
public ServletAuthentication(String usernameField, String passwordField)
Method Detail |
---|
public static void done(HttpServletRequest request)
request
- HttpServletRequest which contains the sessionpublic static boolean logout(HttpServletRequest req)
req
- HttpServletRequestpublic static boolean invalidateAll(HttpServletRequest req)
req
- HttpServletRequestpublic static void killCookie(HttpServletRequest req)
req
- HttpServletRequest which contains the sessionpublic static int strong(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
request
- HttpServletRequestresponse
- HttpServletResponse
ServletException
IOException
public static int strong(HttpServletRequest request, HttpServletResponse response, String realmName) throws ServletException, IOException
request
- HttpServletRequestresponse
- HttpServletResponserealmName
- String name of the realm to authenticate against
ServletException
IOException
public static int assertIdentity(HttpServletRequest request, HttpServletResponse response, String realmName) throws ServletException, IOException, LoginException
request
- HttpServletRequestresponse
- HttpServletResponserealmName
- String name of the realm to authenticate against
ServletException
IOException
LoginException
public static int assertIdentity(HttpServletRequest request, HttpServletResponse response, String realmName, AppContext appContext) throws ServletException, IOException, LoginException
request
- HttpServletRequestresponse
- HttpServletResponserealmName
- String name of the realm to authenticate againstappContext
- AppContext to use when asserting identity
ServletException
IOException
LoginException
public int weak(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
This weak() method, unlike the others, is not static. It requires that the ServletAuthentication object be instantiated with the field names for the username and password inside the form.
request
- HttpServletRequestresponse
- HttpServletResponse
ServletException
IOException
public static int weak(String username, String password, HttpServletRequest request)
username
- Stringpassword
- Stringrequest
- HttpServletRequest
public static int weak(String username, String password, HttpServletRequest request, HttpServletResponse response)
username
- Stringpassword
- Stringrequest
- HttpServletRequestresponse
- HttpServletResponse
public static int login(String username, String password, HttpServletRequest request, HttpServletResponse response) throws LoginException
username
- Stringpassword
- Stringrequest
- HttpServletRequestresponse
- HttpServletResponse
LoginException
public static int weak(String username, String password, HttpSession session)
username
- Stringpassword
- Stringsession
- HttpSession
public static int authObject(String username, Object credential, HttpServletRequest request)
username
- Stringcredential
- Stringrequest
- HttpServletRequest
public static int authObject(String username, Object credential, HttpSession session, HttpServletRequest request)
username
- Stringcredential
- Stringsession
- HttpSession
public static int authenticate(CallbackHandler handler, HttpServletRequest request)
handler
- javax.security.auth.callback.CallbackHandlerrequest
- HttpServletRequest
public static int login(CallbackHandler handler, HttpServletRequest request) throws LoginException
handler
- javax.security.auth.callback.CallbackHandlerrequest
- HttpServletRequest
LoginException
public static void generateNewSessionID(HttpServletRequest request)
request
- HttpServletRequestpublic static Cookie getSessionCookie(HttpServletRequest request, HttpServletResponse response)
response
- HttpServletResponse
public static void runAs(Subject subject, HttpServletRequest request)
subject
- javax.security.auth.Subjectrequest
- HttpServletRequestpublic static String getTargetURLForFormAuthentication(HttpSession session)
session
- HttpSession
public static String getTargetURIForFormAuthentication(HttpSession session)
session
- HttpSession
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs92 Copyright 2006 BEA Systems Inc. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |