public abstract class BaseIDAFilter extends Object implements javax.servlet.Filter
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.core.env.Environment |
env
The env.
|
protected KeyManager |
keyManager
The key manager.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper
The mapper.
|
| Constructor and Description |
|---|
BaseIDAFilter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
authenticateRequest(ResettableStreamHttpServletRequest requestWrapper)
authenticateRequest method used to validate the JSON signature pay load and
the certificate
|
protected void |
consumeRequest(ResettableStreamHttpServletRequest requestWrapper,
Map<String,Object> requestBody)
consumeRequest method is used to manipulate the request where the request is
first reached and along this all validation are done further after successful
decipher.
|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
protected String |
fetchId(ResettableStreamHttpServletRequest requestWrapper,
String attribute)
fetchId used to fetch and determine the id of request
|
protected Map<String,Object> |
getRequestBody(InputStream requestBody)
getRequestBody used to get the request body from the raw input stream
|
void |
init(javax.servlet.FilterConfig filterConfig) |
protected boolean |
isDate(String date)
To validate a string whether its a date or not.
|
protected String |
mapResponse(ResettableStreamHttpServletRequest requestWrapper,
io.mosip.authentication.common.service.filter.CharResponseWrapper responseWrapper,
java.time.temporal.Temporal requestTime)
mapResponse method is used to construct the response for the successful
authentication.
|
protected Map<String,Object> |
removeNullOrEmptyFieldsInResponse(Map<String,Object> responseMap)
removeNullOrEmptyFieldsInResponse method is used to remove all the empty and
null values present in the response
|
protected Map<String,Object> |
setResponseParams(Map<String,Object> requestBody,
Map<String,Object> responseBody)
setResponseParams method is set the transaction ID and response time based on
the request time zone
|
protected Map<String,Object> |
transformResponse(Map<String,Object> responseMap)
transformResponse used to manipulate the response if any.
|
protected void |
validateId(Map<String,Object> requestBody,
String id)
validateId is used to validate the id present in the request
|
protected void |
validateRequest(ResettableStreamHttpServletRequest requestWrapper,
Map<String,Object> requestBody)
validateRequest method is used to validate the version and the ID passed for
the each request
|
protected org.springframework.core.env.Environment env
protected com.fasterxml.jackson.databind.ObjectMapper mapper
protected KeyManager keyManager
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.Filterjavax.servlet.ServletExceptionpublic void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.FilterIOExceptionjavax.servlet.ServletExceptionprotected Map<String,Object> removeNullOrEmptyFieldsInResponse(Map<String,Object> responseMap)
responseMap - the response got after the authenticationprotected void consumeRequest(ResettableStreamHttpServletRequest requestWrapper, Map<String,Object> requestBody) throws IdAuthenticationAppException
requestWrapper - ResettableStreamHttpServletRequestrequestBody - the request bodyIdAuthenticationAppException - the id authentication app exceptionprotected void validateRequest(ResettableStreamHttpServletRequest requestWrapper, Map<String,Object> requestBody) throws IdAuthenticationAppException
requestWrapper - ResettableStreamHttpServletRequestrequestBody - the request body is the request body fetched from input
streamIdAuthenticationAppException - the id authentication app exceptionprotected String fetchId(ResettableStreamHttpServletRequest requestWrapper, String attribute)
requestWrapper - the ResettableStreamHttpServletRequestprotected void validateId(Map<String,Object> requestBody, String id) throws IdAuthenticationAppException
requestBody - the request bodyid - the idIdAuthenticationAppException - the id authentication app exceptionprotected String mapResponse(ResettableStreamHttpServletRequest requestWrapper, io.mosip.authentication.common.service.filter.CharResponseWrapper responseWrapper, java.time.temporal.Temporal requestTime) throws IdAuthenticationAppException
requestWrapper - ResettableStreamHttpServletRequestresponseWrapper - CharResponseWrapperrequestTime - the request timeIdAuthenticationAppException - the id authentication app exceptionprotected Map<String,Object> setResponseParams(Map<String,Object> requestBody, Map<String,Object> responseBody) throws IdAuthenticationAppException
requestBody - the request bodyresponseBody - the response bodyIdAuthenticationAppException - the id authentication app exceptionprotected Map<String,Object> transformResponse(Map<String,Object> responseMap) throws IdAuthenticationAppException
responseMap - the response mapIdAuthenticationAppException - the id authentication app exceptionprotected Map<String,Object> getRequestBody(InputStream requestBody) throws IdAuthenticationAppException
requestBody - ResettableStreamHttpServletRequest get request as
input streamIdAuthenticationAppException - the id authentication app exceptionprotected boolean isDate(String date)
date - the dateprotected abstract void authenticateRequest(ResettableStreamHttpServletRequest requestWrapper) throws IdAuthenticationAppException
requestWrapper - ResettableStreamHttpServletRequestIdAuthenticationAppException - the id authentication app exceptionpublic void destroy()
destroy in interface javax.servlet.FilterCopyright © 2020. All rights reserved.