public class SecurityInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
AUTH_TYPE_BASIC.| Modifier and Type | Field and Description |
|---|---|
static String |
ATTR_NAME_CONTAINER_ADMIN_NAME |
static String |
ATTR_NAME_CONTAINER_ADMIN_PRINCIPAL |
static String |
ATTR_NAME_PRINCIPAL |
static String |
ATTR_NAME_ROLES |
static String |
ATTR_NAME_USERNAME
must be same as MardaoPrincipalInterceptor value
|
static String |
AUTH_PARAM_BASIC |
static String |
AUTH_PARAM_COOKIE |
static String |
AUTH_PARAM_OAUTH |
static String |
AUTH_TYPE_BASIC |
static String |
AUTH_TYPE_COOKIE |
static String |
AUTH_TYPE_OAUTH |
protected static int |
ERR_AUTHENTICATION_FAILED |
protected static int |
ERR_CREDENTIALS_NOT_FOUND |
protected static int |
ERR_SECURITY_BASE |
static String |
HEADER_AUTHORIZATION |
protected static org.slf4j.Logger |
LOG |
static String |
PATH_AH |
static TreeSet<String> |
ROLES_ANONYMOUS |
static String |
USERNAME_ANONYMOUS |
| Constructor and Description |
|---|
SecurityInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
doAuthenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri,
String authValue,
String clientUsername,
Object details)
Returns the realm username if the client is authenticated.
|
String |
getAuthenticationMechanism() |
protected String |
getAuthenticationParamName()
Override to specify authentication value parameter name.
|
protected String |
getAuthenticationValue(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri) |
protected String |
getClientPassword(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri,
String authValue)
Override to return password from authValue.
|
protected String |
getClientUsername(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri,
String authValue)
Override to return username from authValue.
|
protected static String |
getEffectiveMethod(javax.servlet.http.HttpServletRequest request) |
protected String |
getRealmPassword(Object details) |
protected String |
getRealmUsername(String clientUsername,
Object details) |
String |
isAuthenticated(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler,
String uri,
String method,
String authValue)
Checks if a request is authenticated, based only on uri, method and authValue params.
|
protected boolean |
isWhitelistedMethod(String requestURI,
String method) |
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler) |
void |
setAuthenticationMechanism(String authenticationMechanism) |
static void |
setListedMethods(Collection<Map.Entry<String,Collection<String>>> methods,
List<Map.Entry<Pattern,Set<String>>> listedMethods) |
void |
setRealmName(String realmName) |
void |
setSecurityDetailsService(SecurityDetailsService securityDetailsService) |
void |
setWhitelistedMethods(Collection<Map.Entry<String,Collection<String>>> whitelistedMethods) |
protected boolean |
skipEnvironmentPaths(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri) |
protected static final org.slf4j.Logger LOG
protected static final int ERR_SECURITY_BASE
protected static final int ERR_CREDENTIALS_NOT_FOUND
protected static final int ERR_AUTHENTICATION_FAILED
public static final String AUTH_TYPE_BASIC
public static final String AUTH_TYPE_COOKIE
public static final String AUTH_TYPE_OAUTH
public static final String AUTH_PARAM_BASIC
public static final String AUTH_PARAM_COOKIE
public static final String AUTH_PARAM_OAUTH
public static final String ATTR_NAME_USERNAME
public static final String ATTR_NAME_PRINCIPAL
public static final String ATTR_NAME_ROLES
public static final String ATTR_NAME_CONTAINER_ADMIN_NAME
public static final String ATTR_NAME_CONTAINER_ADMIN_PRINCIPAL
public static final String USERNAME_ANONYMOUS
public static final String HEADER_AUTHORIZATION
public static final String PATH_AH
protected String doAuthenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri, String authValue, String clientUsername, Object details)
request - response - uri - authValue - clientUsername - details - protected String getAuthenticationParamName()
AUTH_TYPE_BASIC, AUTH_TYPE_COOKIE, AUTH_TYPE_OAUTHprotected String getAuthenticationValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri)
public boolean preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
throws IOException,
javax.servlet.ServletException
preHandle in interface org.springframework.web.servlet.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterIOExceptionjavax.servlet.ServletExceptionpublic String isAuthenticated(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, String uri, String method, String authValue)
request - not used by this implementationresponse - not used by this implementationhandler - not used by this implementationuri - method - authValue - as returned by {@link SecurityInterceptor#getAuthenticationValue(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)protected String getClientUsername(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri, String authValue)
request - response - uri - authValue - header, param or cookie valueprotected String getClientPassword(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uri, String authValue)
request - response - uri - authValue - header, param or cookie valueprotected String getRealmUsername(String clientUsername, Object details)
clientUsername - details - protected boolean skipEnvironmentPaths(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String uri)
public String getAuthenticationMechanism()
AUTH_TYPE_BASIC,
AUTH_TYPE_COOKIE,
AUTH_TYPE_OAUTH or your custom type.public void setAuthenticationMechanism(String authenticationMechanism)
public void setWhitelistedMethods(Collection<Map.Entry<String,Collection<String>>> whitelistedMethods)
public static void setListedMethods(Collection<Map.Entry<String,Collection<String>>> methods, List<Map.Entry<Pattern,Set<String>>> listedMethods)
public void setSecurityDetailsService(SecurityDetailsService securityDetailsService)
public void setRealmName(String realmName)
protected static String getEffectiveMethod(javax.servlet.http.HttpServletRequest request)
Copyright © 2013. All Rights Reserved.