public class EmulatedServer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected DocumentBuilder |
documentBuilder |
protected DocumentBuilderFactory |
documentFactory |
protected ServerOptions |
options
Test Run Properties for this emulated server
|
protected String |
relayState
RelayState token for SAML2
|
| Constructor and Description |
|---|
EmulatedServer() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildSamlAuthRequest(String href)
Generate a deflated and base64-encoded representation of a SAML authentication request document.
|
protected void |
buildSecurityContext(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
Create a security context for the client, returning a response that sets a cookie.
|
protected void |
enableCors(org.opengis.cite.servlet.http.HttpServletResponse response)
Enable Cross Origin Resource Sharing (CORS).
|
protected boolean |
getAuthenticationEnabled()
Return true if authentication has been set to SAML2 or another valid value in the test server
options.
|
protected static String |
getUri(org.opengis.cite.servlet.http.HttpServletRequest request,
Boolean contextOnly)
Extract the uri from a request object.
|
protected PrintWriter |
getWriterForResponse(org.opengis.cite.servlet.http.HttpServletResponse response)
Get the writer for a HttpServletResponse, so we can send back a body
|
void |
handleRequest(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
Subclasses must override this.
|
protected boolean |
validateSamlAuthenticationResponse(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
Check if the request body has a valid SAML 2.0 Authentication Response document.
|
protected boolean |
validateSecureRequest(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
Validate a request to a secure resource has a valid Security Context.
|
protected DocumentBuilderFactory documentFactory
protected DocumentBuilder documentBuilder
protected ServerOptions options
protected String relayState
protected void enableCors(org.opengis.cite.servlet.http.HttpServletResponse response)
response - Reponse on which to enable CORS headersprotected boolean getAuthenticationEnabled()
protected PrintWriter getWriterForResponse(org.opengis.cite.servlet.http.HttpServletResponse response)
response - HttpServletResponse for the clientprotected static String getUri(org.opengis.cite.servlet.http.HttpServletRequest request, Boolean contextOnly)
request - The request to extractcontextOnly - Only include up to the context pathpublic void handleRequest(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
throws IOException,
TransformerException
request - Request from clientresponse - Response to build to send back to clientIOException - Exception raised when a response writer could not be createdTransformerException - Exception if transformer could not convert document to streamprotected String buildSamlAuthRequest(String href) throws TransformerException
href - The base path of the request handlerTransformerException - Exception if transformer could not convert document to streamprotected void buildSecurityContext(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
throws TransformerException
request - The request from the clientresponse - The response that will be modifiedTransformerException - Exception if transformer could not convert document to streamprotected boolean validateSamlAuthenticationResponse(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
request - The request from the clientresponse - The response to send to the clientprotected boolean validateSecureRequest(org.opengis.cite.servlet.http.HttpServletRequest request,
org.opengis.cite.servlet.http.HttpServletResponse response)
throws TransformerException
request - The request from the clientresponse - The response to send to the clientTransformerException - Exception if transformer could not convert document to streamCopyright © 2021 Open Geospatial Consortium. All rights reserved.