Unicon / shib-cas-authn3

Integrates an external CAS Server and Shibboleth IdPv3.
Apache License 2.0
22 stars 16 forks source link

CAS server encoding #35

Open lchanouha opened 5 years ago

lchanouha commented 5 years ago

Hi, My CAS server (custom CASino app) uses UTF-8-encoded attributes. Shib-Cas module does not set defaut encoding, so i just on method to set it on UTF-8 .

diff --git a/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java b/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java
index 4ce5284..696dd79 100644
--- a/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java
+++ b/src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java
@@ -98,6 +98,7 @@ public class ShibcasAuthServlet extends HttpServlet {
                                            final String authenticationKey, final boolean force) throws ExternalAuthenticationException, IOException {
         try {
             ticketValidator.setRenew(force);
+            ticketValidator.setEncoding("UTF-8");
             final String serviceUrl = constructServiceUrl(request, response, true);
             logger.debug("validating ticket: {} with service url: {}", ticket, serviceUrl);
             final Assertion assertion = ticketValidator.validate(ticket, serviceUrl);

Could parameter to set CAS server encoding (since aperero doesn't support auto-detection bases on xml header) be added, or in 2018 i think we cas set UTF-8 as default encoding.

Sorry for my english, Regards;