cas add filed

cas add filed

package com.jama.credentials;

import org.jasig.cas.authentication.principal.Credentials;

public class LoginInfoCredentials
    implements Credentials
{

    private String account;
    private String password;
    private String randCode;

    public LoginInfoCredentials()
    {
    }

    public String getAccount()
    {
        return account;
    }

    public void setAccount(String account)
    {
        this.account = account;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getRandCode()
    {
        return randCode;
    }

    public void setRandCode(String randCode)
    {
        this.randCode = randCode;
    }
}


package com.jama.credentials;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jasig.cas.authentication.principal.*;

// Referenced classes of package com.jama.credentials:
//            LoginInfoCredentials

public class LoginInfoToPrincipalResolver
    implements CredentialsToPrincipalResolver
{

    private final Log log = LogFactory.getLog(getClass());

    public LoginInfoToPrincipalResolver()
    {
    }

    public Principal resolvePrincipal(Credentials credentials)
    {
        LoginInfoCredentials loginInfo = (LoginInfoCredentials)credentials;
        if(log.isDebugEnabled())
        {
            log.debug((new StringBuilder("Creating SimplePrincipal for [")).append(loginInfo.getAccount()).append("]").toString());
        }
        return new SimplePrincipal(loginInfo.getAccount());
    }

    public boolean supports(Credentials credentials)
    {
        return credentials != null && com/jama/credentials/LoginInfoCredentials.isAssignableFrom(credentials.getClass());
    }
}

你可能感兴趣的:(cas add filed)