使用JAAS在CAS Server上进行身份验证

时间:2012-12-26 05:43:46

标签: authentication cas jaas

我正在尝试在CAS服务器上使用CAS进行SSO和JAAS。用户信息在数据库表中。我为JAAS创建了自己的LoginModule,并在jaas.conf中配置了我的LoginModule 以下是jaas.conf文件。

我在deployerConfigContext.xml中添加了以下行:

CAS   {
    com.usol.cas.sample.CasLoginModule required debug=true
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://linux.ssoserver/ssotest"
    user="cas"
    password="cas";
};

我发现JaasAuthenticationHandler没有使用我的CasLoginModule。

<bean class="org.jasig.cas.authentication.handler.support.JaasAuthenticationHandler" />

我在我的java源代码中写了System.out.println行,但是没有输出,我在jaas.conf文件中更改了我的类名错误地使ClassNotFoundError但没有发生错误。 你觉得是什么原因? 我无法解决我的问题。

提前谢谢。

1 个答案:

答案 0 :(得分:1)

结帐我的代码..像魅力一样......

   <bean
                class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
        </list>
    </property>

    <!--
        | Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
        | AuthenticationHandlers actually authenticate credentials.  Here we declare the AuthenticationHandlers that
        | authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
        | until it finds one that both supports the Credentials presented and succeeds in authenticating.
        +-->
        <property name="authenticationHandlers">
        <list>

               <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" p:httpClient-ref="httpClient"></bean>

                                                                         user_master                                                                                                           用户名                                                                                                           用户密码                                                                                                                                                                                                                                                                                

          </list>
        </property>
</bean>


  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
            <value>net.sourceforge.jtds.jdbc.Driver</value>
    </property>

    <property name="url">
            <value>jdbc:jtds:sqlserver://localhost:port/db</value>
    </property>

    <property name="username">
            <value>1234</value>
    </property>

    <property name="password">
        <value>password</value>
    </property>
</bean>