allen
专注于java ee技术,包括struts,jsf,webwork,spring,hibernate,ibatis
posts - 7,  comments - 9,  trackbacks - 0

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());
    }
}

posted on 2006-12-08 13:48 robbin163 阅读(266) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2006年12月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(3)

随笔分类

随笔档案

文章分类

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜