How to fix Error in uPortal CAS Authentication after configuring SSL

479 views
Skip to first unread message

Eduardo Fonseca

unread,
Dec 28, 2016, 11:33:47 AM12/28/16
to uPortal Community
Hello,
I am configuring uPortal and we are researching about integrating it's built-in CAS authentication with a client app running on php.
I have had good progress but got to a point where I am able to authenticate with the phpCAS but the uPortal authentication ends up broken.

I am using Tomcat 7, and followed the steps to configure SSL on port 8443
so enabled this connector:

    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <Connector
               protocol="org.apache.coyote.http11.Http11NioProtocol"
               port="8443" maxThreads="200"
               scheme="https" secure="true" SSLEnabled="true"
               keystoreFile="${user.home}/.keystore" keystorePass="uportal"
               clientAuth="false" sslProtocol="TLS"/>

also made sure that the uPortal configuration is correctly setup for CAS authentication on port 8443 with localhost as hostname, in cas.properties and local.properties.

uportal runs, I can navigate to the Sign In page, I can input the username and password, however, once I click Login, I get the following result

We're sorry, but an error has occurred.

Please contact your uPortal administrator and provide the following information:

Your name and user id
What content were you trying to view when this error occurred
Any other useful information to help reproduce the error

This is the url on the Login page:

This the the url where is redirecting: 

I'm using a self signed certificate as specified in the SSL configuration for Tomcat 7

However when using the php application I can authenticate
Successfull Authentication!

Current script
index.php
session_name():
PHPSESSID
session_id():
ST-7-mla0RUWx4GX1mSsdPJd9-localhost
the user's login is admin.

phpCAS version is 1.3.4+.

Logout

Also, if I set tomcat and uportal to go back to use http, and port 8080, uPortal login works again.

Any ideas what I need to do so the uPortal authentication does not break when using https, SSL, and port 8443?

I'm using Tomcat 7, uPortal 4.3.1 and it's built-in CAS server

Benito J. Gonzalez

unread,
Dec 28, 2016, 12:16:28 PM12/28/16
to Eduardo Fonseca, uPortal Community
Hi Eduardo,

Did you update the server/port and protocol for uPortal in the filters
file you are using? The default one is filters/local.properties.

-bjagg

On 12/28/2016 08:33 AM, Eduardo Fonseca wrote:
> Hello,
> I am configuring uPortal and we are researching about integrating it's
> built-in CAS authentication with a client app running on php.
> I have had good progress but got to a point where I am able to
> authenticate with the phpCAS but the uPortal authentication ends up broken.
>
> I am using Tomcat 7, and followed the steps to configure SSL on port 8443
> so enabled this connector:
> *
> *
> * <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->*
> * <Connector*
> * protocol="org.apache.coyote.http11.Http11NioProtocol"*
> * port="8443" maxThreads="200"*
> * scheme="https" secure="true" SSLEnabled="true"*
> * keystoreFile="${user.home}/.keystore"
> keystorePass="uportal"*
> * clientAuth="false" sslProtocol="TLS"/>*
>
> also made sure that the uPortal configuration is correctly setup for CAS
> authentication on port 8443 with localhost as hostname, in
> cas.properties and local.properties.
>
> uportal runs, I can navigate to the Sign In page, I can input the
> username and password, however, once I click Login, I get the following
> result
>
> *We're sorry, but an error has occurred.*
> *
> *
> *Please contact your uPortal administrator and provide the following
> information:*
> *
> *
> *Your name and user id*
> *What content were you trying to view when this error occurred*
> *Any other useful information to help reproduce the error*
> *Successfull Authentication!*
> *
> *
> *Current script*
> *index.php*
> *session_name():*
> *PHPSESSID*
> *session_id():*
> *ST-7-mla0RUWx4GX1mSsdPJd9-localhost*
> *the user's login is admin.*
> *
> *
> *phpCAS version is 1.3.4+.*
> *
> *
> *Logout*
> *
> *
> Also, if I set tomcat and uportal to go back to use http, and port 8080,
> uPortal login works again.
>
> Any ideas what I need to do so the uPortal authentication does not break
> when using https, SSL, and port 8443?
>
> I'm using Tomcat 7, uPortal 4.3.1 and it's built-in CAS server
>
> --
> You received this message because you are subscribed to the Google
> Groups "uPortal Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to uportal-user...@apereo.org
> <mailto:uportal-user...@apereo.org>.
> Visit this group at
> https://groups.google.com/a/apereo.org/group/uportal-user/.

--
Benito J. Gonzalez
Software Developer
Unicon, Inc.
Voice: 480.558.2360
Text: 209.777.2754
Email: bgon...@unicon.net
GitHub: bjagg
GitLab: bjagg
BitBucket: bjagg

Eduardo Fonseca

unread,
Dec 28, 2016, 12:25:01 PM12/28/16
to uPortal Community, efon...@gmail.com
Hello, yes I did, I was looking at the logs and I found an error building the path to the certificate, not sure if this may be the cause of the issue.
I did run the command to create the keystore and set the correct password in server.xml for Tomcat.
BTW, I'm using Windows.


Dec 28, 2016 9:22:30 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [AuthenticationDispatcherServlet] in context with path [/uPortal] threw exception
java.lang.RuntimeException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:341)
at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:305)
at org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.java:50)
at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:208)
at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:169)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.jasig.portal.security.firewall.RequestParameterPolicyEnforcementFilter.doFilter(RequestParameterPolicyEnforcementFilter.java:215)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.jasig.services.persondir.support.web.RequestAttributeSourceFilter.doFilter(RequestAttributeSourceFilter.java:349)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.jasig.portal.security.ThreadNamingRequestFilter.doFilterInternal(ThreadNamingRequestFilter.java:76)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.jasig.portal.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:270)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getInputStream(HttpsURLConnectionOldImpl.java:224)
at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:326)
... 43 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
... 56 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
... 62 more

Benito J. Gonzalez

unread,
Dec 28, 2016, 12:29:12 PM12/28/16
to Eduardo Fonseca, uPortal Community
Oh ok, you created a self-signed certification and imported into the
keystore you are referencing in Tomcat. That's good. Did you import the
key into the JDK keystore as trusted? That keystore is at
$JAVA_HOME/jre/lib/security/keystore with a password of "changeme", if I
recall correctly.

This caught me a few weeks ago. I had forgotten to import the
certification in the Java JDK's keystore and banged my head at the
problem for a bit.

-bjagg
> > an email to uportal-user...@apereo.org <javascript:>
> > <mailto:uportal-user...@apereo.org <javascript:>>.
> <https://groups.google.com/a/apereo.org/group/uportal-user/>.
>
> --
> Benito J. Gonzalez
> Software Developer
> Unicon, Inc.
> Voice: 480.558.2360
> Text: 209.777.2754
> Email: bgon...@unicon.net <javascript:>
> GitHub: bjagg
> GitLab: bjagg
> BitBucket: bjagg
>
> --
> You received this message because you are subscribed to the Google
> Groups "uPortal Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to uportal-user...@apereo.org
> <mailto:uportal-user...@apereo.org>.

Eduardo Fonseca

unread,
Dec 28, 2016, 12:34:16 PM12/28/16
to uPortal Community, efon...@gmail.com
I thought I had do it, I haven't really use java for years so not sure.
I don't see any .cer files, basically all I did was using the keytool command to create the .keystore file in the user's home directory.
Thought only needed to do that.
>     > <mailto:uportal-user+unsub...@apereo.org <javascript:>>.
>     > Visit this group at
>     > https://groups.google.com/a/apereo.org/group/uportal-user/
>     <https://groups.google.com/a/apereo.org/group/uportal-user/>.
>
>     --
>     Benito J. Gonzalez
>     Software Developer
>     Unicon, Inc.
>     Voice:  480.558.2360
>      Text:  209.777.2754
>     Email:  bgon...@unicon.net <javascript:>
>     GitHub:  bjagg
>     GitLab:  bjagg
>     BitBucket:  bjagg
>
> --
> You received this message because you are subscribed to the Google
> Groups "uPortal Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to uportal-user...@apereo.org

Benito J. Gonzalez

unread,
Dec 28, 2016, 12:47:17 PM12/28/16
to Eduardo Fonseca, uPortal Community
No, also need to get your certificate into the JDK keystore.

You should export your "tomcat" certificate with:

keytool -export -alias tomcat -file tomcat.crt

Once you get it into a file, then you import it into the JDK one:

keytool -import -trustcacerts -file tomcat.crt -alias tomcat -keystore
$JAVA_HOME/jre/lib/security/cacerts

the alias name may not be exactly what you used, but it should get you
going in the right direction.

Let us know how it goes!
-bjagg
> > > <mailto:uportal-user...@apereo.org <javascript:>
> <javascript:>>.
> > > Visit this group at
> > > https://groups.google.com/a/apereo.org/group/uportal-user/
> <https://groups.google.com/a/apereo.org/group/uportal-user/>
> > <https://groups.google.com/a/apereo.org/group/uportal-user/
> <https://groups.google.com/a/apereo.org/group/uportal-user/>>.
> >
> > --
> > Benito J. Gonzalez
> > Software Developer
> > Unicon, Inc.
> > Voice: 480.558.2360
> > Text: 209.777.2754
> > Email: bgon...@unicon.net <javascript:>
> > GitHub: bjagg
> > GitLab: bjagg
> > BitBucket: bjagg
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "uPortal Community" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to uportal-user...@apereo.org <javascript:>
> > <mailto:uportal-user...@apereo.org <javascript:>>.
> > Visit this group at
> > https://groups.google.com/a/apereo.org/group/uportal-user/
> <https://groups.google.com/a/apereo.org/group/uportal-user/>.
>
> --
> Benito J. Gonzalez
> Software Developer
> Unicon, Inc.
> Voice: 480.558.2360
> Text: 209.777.2754
> Email: bgon...@unicon.net <javascript:>
> GitHub: bjagg
> GitLab: bjagg
> BitBucket: bjagg
>
> --
> You received this message because you are subscribed to the Google
> Groups "uPortal Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to uportal-user...@apereo.org
> <mailto:uportal-user...@apereo.org>.

Eduardo Fonseca

unread,
Dec 28, 2016, 3:25:52 PM12/28/16
to uPortal Community, efon...@gmail.com
Great, thanks a lot, that did it.
>     >     > <mailto:uportal-user+unsub...@apereo.org <javascript:>
>     <javascript:>>.
>     >     > Visit this group at
>     >     > https://groups.google.com/a/apereo.org/group/uportal-user/
>     <https://groups.google.com/a/apereo.org/group/uportal-user/>
>     >     <https://groups.google.com/a/apereo.org/group/uportal-user/
>     <https://groups.google.com/a/apereo.org/group/uportal-user/>>.
>     >
>     >     --
>     >     Benito J. Gonzalez
>     >     Software Developer
>     >     Unicon, Inc.
>     >     Voice:  480.558.2360
>     >      Text:  209.777.2754
>     >     Email:  bgon...@unicon.net <javascript:>
>     >     GitHub:  bjagg
>     >     GitLab:  bjagg
>     >     BitBucket:  bjagg
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "uPortal Community" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to uportal-user...@apereo.org <javascript:>
>     > <mailto:uportal-user+unsub...@apereo.org <javascript:>>.
>     > Visit this group at
>     > https://groups.google.com/a/apereo.org/group/uportal-user/
>     <https://groups.google.com/a/apereo.org/group/uportal-user/>.
>
>     --
>     Benito J. Gonzalez
>     Software Developer
>     Unicon, Inc.
>     Voice:  480.558.2360
>      Text:  209.777.2754
>     Email:  bgon...@unicon.net <javascript:>
>     GitHub:  bjagg
>     GitLab:  bjagg
>     BitBucket:  bjagg
>
> --
> You received this message because you are subscribed to the Google
> Groups "uPortal Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to uportal-user...@apereo.org

Axel Banderet

unread,
May 22, 2017, 8:14:32 AM5/22/17
to uPortal Community
Reply all
Reply to author
Forward
0 new messages