Mod_Auth_Cas Headers

42 views
Skip to first unread message

Ramakrishna G

unread,
Sep 29, 2018, 9:04:22 AM9/29/18
to CAS Community
Hello all,

I have custom authentication handler in CAS where I set headers post successful validation of user. This is my code snippet.

if(isValidUser(credentials.getUsername(), credentials.getPassword()))
        {
        HttpServletResponse httpResponse = (HttpServletResponse) ExternalContextHolder.getExternalContext().getNativeResponse();
            httpResponse.addHeader("CAS-Username",credentials.getUsername());
            httpResponse.addHeader("CAS-Status",status);
            httpResponse.addHeader("CAS-LastLoginTime",lastlogin);
           
        final String username = credentials.getUsername();
        AuthenticationHandlerExecutionResult result = createHandlerResult(credentials, this.principalFactory.createPrincipal(username));
        return result;
        }

And I am using Mod_auth_cas CAS client. Now my problem is I am unable to receive the headers set in CAS.

My Mod_auth_cas config is:

cas.conf
LoadModule auth_cas_module modules/mod_auth_cas.so
CASCertificatePath /etc/pki/tls/certs/cas.com.crt
CASCookiePath /var/cache/mod_auth_cas/
CASRootProxiedAs https://xxx.xxx.com
CASCookieDomain cas.com
CASSSOEnabled On
CASIdleTimeout 1500
CASAttributePrefix "CAS-"

ssl.conf
 <Location />
                AllowOverride
                AuthType CAS
                require valid-user
                ProxyPass http://localhost/index.php
                ProxyPassReverse http://localhost/index.php
                CASAuthNHeader user-info
         </Location>

And in my index.php file I am printing all the headers received. The problem is I always only receive HTTP_USER_INFO :: cas.
 I want to receive all the headers set in CAS. Am i missing something? Can someone help me in getting all the headers.

Thanks
Ramakrishna G


David Hawes

unread,
Oct 1, 2018, 12:32:17 PM10/1/18
to CAS Community
Just so I understand, you are setting headers on the validation
response to mod_auth_cas in your CAS server and expect the headers to
show up?

They will not show up.

You will need add those headers to the attributes sent back in the
validation response for them to be available as headers in you PHP
script.
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cas-user+u...@apereo.org.
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAGST5P84WfKGrnaBKsy%3DANvk2DQ-tC8VNQGB8ZGhk5N%2BVu0bGQ%40mail.gmail.com.

Ramakrishna G

unread,
Oct 1, 2018, 2:02:45 PM10/1/18
to cas-...@apereo.org
David,

Can you pls share code snippet or link for setting headers to response attribute.

Thanks
Ramakrishna
> To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAAgu-wC1SZd6w9P_AupPcPAu1AdG69v-2nnF_MfFMbGbc6xT%2Bg%40mail.gmail.com.

David Hawes

unread,
Oct 1, 2018, 3:10:59 PM10/1/18
to CAS Community
On 1 October 2018 at 14:02, Ramakrishna G <ramak...@teligenz.in> wrote:
> David,
>
> Can you pls share code snippet or link for setting headers to response attribute.

The wording was confusing in my last email, but we are just talking
about attribute release here. You should review the documentation for
your CAS server.
Reply all
Reply to author
Forward
0 new messages