Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option "shibcas.doNotCache" #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ shibcas.serverName = https://shibserver.example.edu
# Specify if the Relying Party/Service Provider entityId should be appended as a separate entityId query string parameter
# or embedded in the "service" querystring parameter - `append` (default) or `embed`
# shibcas.entityIdLocation = append

# If you decide to embed entityId in querystring, CAS can decide MFA based on entityId.
# In that case you do not want to cache the result
# (otherwise the first succesful CAS login will be kept)
# (alternative is to use "idp.session.enabled = false" but you loose SLO)
#shibcas.doNotCache = true

...
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class ShibcasAuthServlet extends HttpServlet {
private String casServerPrefix;
private String ticketValidatorName;
private String entityIdLocation;
private Boolean doNotCache;

private AbstractCasProtocolUrlBasedTicketValidator ticketValidator;

Expand Down Expand Up @@ -107,6 +108,10 @@ private void validatevalidateCasTicket(final HttpServletRequest request, final H
for (final CasToShibTranslator casToShibTranslator : translators) {
casToShibTranslator.doTranslation(request, response, assertion, authenticationKey);
}
if (doNotCache) {
request.setAttribute(ExternalAuthentication.DONOTCACHE_KEY, true);
}

} catch (final Exception e) {
logger.error("Ticket validation failed, returning InvalidTicket", e);
request.setAttribute(ExternalAuthentication.AUTHENTICATION_ERROR_KEY, "InvalidTicket");
Expand Down Expand Up @@ -209,6 +214,9 @@ private void parseProperties(final Environment environment) {

entityIdLocation = environment.getProperty("shibcas.entityIdLocation", "append");
logger.debug("shibcas.entityIdLocation: {}", entityIdLocation);

doNotCache = Boolean.parseBoolean(environment.getProperty("shibcas.doNotCache"));
logger.debug(properties_prefix + ".doNotCache: {}", doNotCache);
}

private void buildParameterBuilders(final ApplicationContext applicationContext) {
Expand Down