public class RemoteAuthServlet extends WebappServlet
The property remote_auth.realm (which may be set as a servlet parameter) defines the name realm used by the servlet. Multiple types of external authentication can be supported by including the servlet at multiple paths, one for each realm.
This servlet also supports the use of a remote authentication server rather than expecting the name to be provided by the container. This should only be needed for methods the container cannot support directly. In this mode the user is redirected to a remote server. A session token will be included as the url parameter token. The server should authenticate the user and (if successful) redirect back to this servlet setting the auth_name parameter to the authenticated user. The response should also contain the check_token parameter which should be a hex encoded hash value calculated from the concatenation of the user-name, the-token and a secret-value shared between the two servers. Optionally the server can pre-pend the response with a salt string. In this case the salt should also be returned as a parameter named salt. Adding a salt to the check_token may make it harder for a malicious user to reverse engineer the check_token as the unknown parts of the input vary each call. This should not be required for a well implemented hash function.
Hash
to use defaults to SHA512
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REGISTER_IDENTITY_DEFAULT_TEXT |
static java.lang.String |
REMOTE_AUTH_REALM_PROP
Property name to use for the authentication realm.
|
static java.lang.String |
SERVICE_WEB_LOGIN_UPDATE_TEXT |
static Feature |
WEB_LOGIN_FEATURE
Feature to allow external auth logins as alternative mechanism via specific servlets linked from the
login page.
|
ARGS, CONFIRM_NO, CONFIRM_POST_URL, CONFIRM_TYPE, CONFIRM_YES, EXTRA_HTML, MESSAGE_EXTRA_ATTR, MESSAGE_TYPE_ATTR, MESSAGES_JSP_URL, SCRIPTS_CONFIRM_JSP
Constructor and Description |
---|
RemoteAuthServlet() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canLogin(AppContext conn,
java.lang.String realm) |
static boolean |
canRegisterNewUser(AppContext conn)
Test if the bind external id should be offered
ie is there an existing session user or a stored newly registered user.
|
protected void |
doPost(HttpServletRequest req,
HttpServletResponse res,
AppContext conn)
Method that does the actual work
|
static boolean |
registerNewUser(AppContext conn,
AppUser user)
Set the user that should be registered (and logged in) if the
external authentication succeeds.
|
static void |
setNextResult(SessionService<?> sess,
SerializableFormResult next)
set a result to go to after re-authentication/register
|
badInputCheck, checkBadInput, confirm, confirm, doGet, doPost, doPut, doPut, encodeCGI, getLogger, handleFormResult, message, message, messageWithArgs, sendMessageWithArgs
public static final java.lang.String REMOTE_AUTH_REALM_PROP
DefaultServletService
and RegisterServlet
if global external authentication is supported.public static final java.lang.String SERVICE_WEB_LOGIN_UPDATE_TEXT
public static final java.lang.String REGISTER_IDENTITY_DEFAULT_TEXT
public static final Feature WEB_LOGIN_FEATURE
protected void doPost(HttpServletRequest req, HttpServletResponse res, AppContext conn) throws ServletException, java.io.IOException
WebappServlet
doPost
in class WebappServlet
ServletException
java.io.IOException
public static boolean registerNewUser(AppContext conn, AppUser user)
conn
- user
- public static boolean canRegisterNewUser(AppContext conn)
conn
- public static boolean canLogin(AppContext conn, java.lang.String realm)
public static void setNextResult(SessionService<?> sess, SerializableFormResult next)
sess
- next
-