Custom Authentication Handler in version 5.0.0

703 views
Skip to first unread message

Gokhan Mansuroglu

unread,
Sep 8, 2016, 4:47:25 AM9/8/16
to CAS Community
Hi,

Let's say I have a custom AbcAuthencticationHandler and AbcCredentials. How can i configure this custom auhtentication handler ? In previous versions this can be handled in deployerConfigContext.xml, but how it is done in version 5.0.0 ?

Thanks.

Misagh Moayyed

unread,
Sep 8, 2016, 5:17:03 AM9/8/16
to CAS Community, Gokhan Mansuroglu

Example: https://github.com/apereo/cas/blob/master/cas-server-support-digest-authentication/src/main/java/org/apereo/cas/digest/config/DigestAuthenticationConfiguration.java#L128


-- 
Misagh
--
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 post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/0a0ba25b-2dff-4cae-aa1b-a639cd629bc9%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

Gokhan Mansuroglu

unread,
Sep 9, 2016, 8:18:02 AM9/9/16
to CAS Community, gokhan.m...@gmail.com, mmoa...@unicon.net
Hi Misagh,

Thank you for your link, I am trying to figure it out. However there is definetely a need for a step by step guide.

8 Eylül 2016 Perşembe 12:17:03 UTC+3 tarihinde Misagh Moayyed yazdı:

Philippe MARASSE

unread,
Sep 12, 2016, 11:22:02 AM9/12/16
to cas-...@apereo.org
+1

I need to add a step in login webflow, how to add custom configuration properties to a Configurer class ? via a custom @EnableConfigurationProperties(MyConfigProperties.class) ?

Regards.

-- 
Philippe MARASSE

Responsable pôle Infrastructures - DSIO
Centre Hospitalier Henri Laborit
CS 10587 - 370 avenue Jacques Cœur 
86021 Poitiers Cedex
Tel : 05.49.44.57.19

Gokhan Mansuroglu

unread,
Sep 20, 2016, 10:09:00 AM9/20/16
to jasig-cas-user, cas-...@apereo.org, gokhan.m...@gmail.com, mmoa...@unicon.net
I have a problem with this configuration. I have a MyUsernamePasswordCredential that extends UsernamePasswordCredential, but unfortunately I can't bind this model in the flow. How is that possible ?

Thank you.

9 Eylül 2016 Cuma 15:18:03 UTC+3 tarihinde Gokhan Mansuroglu yazdı:
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.

To post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.

Natan Zeferino

unread,
Nov 8, 2016, 10:56:58 AM11/8/16
to CAS Community
Hi,

Did you resolve that problem?

I want to do the same.

Philippe MARASSE

unread,
Nov 9, 2016, 4:03:21 PM11/9/16
to cas-...@apereo.org
Hi,

Not resolved yet unfortunately.

Regards.
--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
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.

john c

unread,
Nov 10, 2016, 4:33:03 AM11/10/16
to jasig-cas-user, cas-...@apereo.org, gokhan.m...@gmail.com, mmoa...@unicon.net
1. declare MyUsernamePasswordCredential in  your webflow.xml
2. support MyUsernamePasswordCredential in  your authentication handler
3. you need a configer class to reg your handler into cas, load configer info etc...

take a look :


在 2016年9月20日星期二 UTC+8下午10:08:53,Gokhan Mansuroglu写道:

Gokhan Mansuroglu

unread,
Nov 15, 2016, 9:02:11 AM11/15/16
to jasig-cas-user, cas-...@apereo.org, gokhan.m...@gmail.com, mmoa...@unicon.net
When I declare it as below, CAS still use its UsernamePasswordCredential.

<var name="credential" class="MyUsernamePasswordCredential" />

I could use MyUsernamePasswordCredential only if  I change the var name in the login-webflow and loginform as below :

<var name="myCredential" class="MyUsernamePasswordCredential" />

<form method="post" id="fm1" th:object="${myCredential}">

However this lead me to another problems like :

java.lang.IllegalArgumentException: No authentication result builder can be located in the context
    at org
.apereo.cas.web.flow.resolver.impl.InitialAuthenticationAttemptWebflowEventResolver.resolveInternal(InitialAuthenticationAttemptWebflowEventResolver.java:71) ~[cas-server-core-webflow-5.0.0.RC1.jar:5.0.0.RC1]
    at org
.apereo.cas.web.flow.resolver.impl.AbstractCasWebflowEventResolver.resolve(AbstractCasWebflowEventResolver.java:427) ~[cas-server-core-webflow-5.0.0.RC1.jar:5.0.0.RC1]



Do I have to change the var name ? What do you suggest ?

Thank you.

10 Kasım 2016 Perşembe 12:33:00 UTC+3 tarihinde john c yazdı:

Raghavendra Chary B

unread,
Nov 21, 2016, 12:27:58 PM11/21/16
to CAS Community
I had to implement custom Authentication handler where user creds are stored in Cassandra db.

Followed below steps, not sure whether this is recommneded approach or not:
1. Created package org.apereo.cas.<custom>.adaptors.cassandra
2. CassandraAuthenticationHandler
public class CassandraAuthenticationHandler implements AuthenticationHandler {

}
3. Created org.apereo.cas.<custom>.adaptors.cassandra.config.CasCassandraConfiguration similar to org.apereo.cas.adaptors.generic.config.CasGenericConfiguration.

@Configuration("casCassandraConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class CasCassandraConfiguration {

    @RefreshScope
    @Bean
    public AuthenticationHandler cassandraAuthenticationHandler() {
        final CassandraAuthenticationHandler h = new CassandraAuthenticationHandler();
        return h;
    }


    @PostConstruct
    public void initializeAuthenticationHandler() {
        System.out.println("1755");
        this.authenticationHandlersResolvers.put(cassandraAuthenticationHandler(), personDirectoryPrincipalResolver);
    }

Misagh Moayyed

unread,
Nov 29, 2016, 10:19:34 AM11/29/16
to cas-...@apereo.org

Do you mind sharing the source for the actual CassandraAuthenticationHandler and everything else it depends on? This somewhere on Github I can review?

 

--Misagh

 

From: cas-...@apereo.org [mailto:cas-...@apereo.org] On Behalf Of Raghavendra Chary B


Sent: Monday, November 21, 2016 10:28 AM
To: CAS Community <cas-...@apereo.org>

--

- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---

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.

Raghavendra Chary B

unread,
Nov 30, 2016, 1:44:03 AM11/30/16
to CAS Community, mmoa...@unicon.net

Raghavendra Chary B

unread,
Jun 22, 2017, 3:46:03 AM6/22/17
to CAS Community, mmoa...@unicon.net
Hi Misagh,

Custom cassandra auth handler was working in CAS 5.0.0. I upgraded to CAS 5.1.0, it stopped working.
I added getOrder method as AuthenticationHandler in 5.1.0 needs it.

Please let me know if any other config i missed.

Raghavendra Chary B

unread,
Jun 23, 2017, 12:53:31 AM6/23/17
to CAS Community, mmoa...@unicon.net
Thanks Misagh, I got it working with the help of below link:
https://apereo.github.io/2017/02/02/cas51-authn-handlers/

I had to upgrade cassandra-driver to 3.2.0, because with 3.1.0 i faced issue https://datastax-oss.atlassian.net/browse/JAVA-1328.

Misagh Moayyed

unread,
Jun 23, 2017, 11:16:01 AM6/23/17
to cas-...@apereo.org

Sure thing. The blog more or less is also available here:

https://apereo.github.io/cas/5.1.x/installation/Configuring-Custom-Authentication.html

 

I also may suggest that you check out 5.2. There is support for Cassandra AuthN. If that’s something you need, you may want to merge what you have done with what exists and simply use “native” functionality.

 

--Misagh

 

From: Raghavendra Chary B [mailto:cha...@gmail.com]

Sent: Thursday, June 22, 2017 9:54 PM
To: CAS Community <cas-...@apereo.org>


This email has been scanned for spam and viruses by Proofpoint Essentials. Click here to report this email as spam.


=

Reply all
Reply to author
Forward
0 new messages