HandlerResult

66 views
Skip to first unread message

Jeffrey Ramsay

unread,
Oct 21, 2020, 9:46:35 AM10/21/20
to CAS Community
Hello -

I am trying to build an authentication handler in cas 6.2 using the stub code from the example and cannot get past the following error message.

Does anyone know if this is no longer valid? or where I can find the module where this class is defined?

error: cannot find symbol
import org.apereo.cas.authentication.HandlerResult;
                                    ^
  symbol:   class HandlerResult
  location: package org.apereo.cas.authentication

Thanks,
-Jeff

Dmitriy Kopylenko

unread,
Oct 21, 2020, 10:05:56 AM10/21/20
to cas-...@apereo.org
Hi there.

Which stub code example?


Best,
D.

--
- 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/CA%2BTBYOSeMy3naZ_J7_v%2B2BZFmMBF1x3mV1o68OvtyKjr%3Dd2T2w%40mail.gmail.com.

Jeffrey Ramsay

unread,
Oct 21, 2020, 1:11:10 PM10/21/20
to CAS Community
Hello,

I was following the code listed here.


Also, I added the following to build.gradle:

    implementation "org.apereo.cas:cas-server-core-api-authentication:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-core-authentication-api:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-support-generic:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-support-actions:${casServerVersion}"  
    implementation "org.apereo.cas:cas-server-core-authentication:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-core-authentication-attributes:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-core-services-authentication:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-core-configuration:${casServerVersion}"
    implementation "org.apereo.cas:cas-server-core-configuration-api:${casServerVersion}"

And the code I'm testing.

package com.example.cas;

import org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler;
import org.apereo.cas.authentication.credential.UsernamePasswordCredential;
import org.apereo.cas.authentication.principal.PrincipalFactory;
import org.apereo.cas.authentication.PreventedException;
import org.apereo.cas.services.ServicesManager;
import org.apereo.cas.authentication.Credential;
import java.security.GeneralSecurityException;

import org.apereo.cas.authentication.principal.Principal;

public class MyAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler {

    public MyAuthenticationHandler(String name, ServicesManager servicesManager, PrincipalFactory principalFactory, Integer order) {
        super(name, servicesManager, principalFactory, order);
    }

    @Override
    protected HandlerResult authenticateUsernamePasswordInternal(
                                                                 final UsernamePasswordCredential credential,
                                                                 final String originalPassword) {
        return createHandlerResult(credential, this.principalFactory.createPrincipal(username), null);
    }
}

-Jeff

Dmitriy Kopylenko

unread,
Oct 21, 2020, 3:10:59 PM10/21/20
to cas-...@apereo.org
Unfortunately, the documentation is not up to date. The API has changed. As you could see there is no HandlerResult type anymore: https://github.com/apereo/cas/blob/6.2.x/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/AbstractUsernamePasswordAuthenticationHandler.java#L120

It’s called AuthenticationHandlerExecutionResult

See if you could adopt your implementation to the latest API

Best,
D.

Jeffrey Ramsay

unread,
Oct 21, 2020, 4:53:39 PM10/21/20
to CAS Community
Dmitriy,

Thank you; much appreciated.

-Jeff

Reply all
Reply to author
Forward
0 new messages