public abstract class AbstractUrlBasedTicketValidator extends Object implements TicketValidator
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
Modifier | Constructor and Description |
---|---|
protected |
AbstractUrlBasedTicketValidator(String casServerUrlPrefix)
Constructs a new TicketValidator with the casServerUrlPrefix.
|
Modifier and Type | Method and Description |
---|---|
protected String |
constructValidationUrl(String ticket,
String serviceUrl)
Constructs the URL to send the validation request to.
|
protected String |
encodeUrl(String url)
Encodes a URL using the URLEncoder format.
|
protected String |
getCasServerUrlPrefix() |
protected Map<String,String> |
getCustomParameters() |
protected String |
getEncoding() |
protected HttpURLConnectionFactory |
getURLConnectionFactory() |
protected abstract String |
getUrlSuffix()
The endpoint of the validation URL.
|
protected boolean |
isRenew() |
protected abstract Assertion |
parseResponseFromServer(String response)
Parses the response from the server into a CAS Assertion.
|
protected void |
populateUrlAttributeMap(Map<String,String> urlParameters)
Template method for ticket validators that need to provide additional parameters to the validation url.
|
protected abstract String |
retrieveResponseFromServer(URL validationUrl,
String ticket)
Contacts the CAS Server to retrieve the response for the ticket validation.
|
void |
setCustomParameters(Map<String,String> customParameters) |
void |
setEncoding(String encoding) |
void |
setRenew(boolean renew) |
void |
setURLConnectionFactory(HttpURLConnectionFactory urlConnectionFactory) |
Assertion |
validate(String ticket,
String service)
Attempts to validate a ticket for the provided service.
|
protected AbstractUrlBasedTicketValidator(String casServerUrlPrefix)
casServerUrlPrefix
- the location of the CAS server.protected void populateUrlAttributeMap(Map<String,String> urlParameters)
urlParameters
- the map containing the parameters.protected abstract String getUrlSuffix()
protected final String constructValidationUrl(String ticket, String serviceUrl)
ticket
- the ticket to be validated.serviceUrl
- the service identifier.protected final String encodeUrl(String url)
url
- the url to encode.protected abstract Assertion parseResponseFromServer(String response) throws TicketValidationException
response
- the response from the server, in any format.TicketValidationException
- if an Assertion could not be created.protected abstract String retrieveResponseFromServer(URL validationUrl, String ticket)
validationUrl
- the url to send the validation request to.ticket
- the ticket to validate.public final Assertion validate(String ticket, String service) throws TicketValidationException
TicketValidator
validate
in interface TicketValidator
ticket
- the ticket to attempt to validate.service
- the service this ticket is valid for.TicketValidationException
- if the ticket cannot be validated.public final void setRenew(boolean renew)
public final void setEncoding(String encoding)
protected final String getEncoding()
protected final boolean isRenew()
protected final String getCasServerUrlPrefix()
protected HttpURLConnectionFactory getURLConnectionFactory()
public void setURLConnectionFactory(HttpURLConnectionFactory urlConnectionFactory)
Copyright © 2006–2017 Jasig. All rights reserved.