Dongkyun
Dongkyun

Reputation: 61

authentication on CAS Server by using JAAS

I am trying to use CAS for SSO and JAAS on CAS Server. The user information is on database table. I created my own LoginModule for JAAS and I configured my LoginModule in jaas.conf.
The below is the jaas.conf file.

and I added the below line in 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";
};

I found JaasAuthenticationHandler does not use my CasLoginModule.

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

I wrote System.out.println line in my java source but there was no output and I changed my class name in jaas.conf file incorrectly to make ClassNotFoundError but no error happened. What is the reason do you think? I could not resolve my issue.

Thank you in advance.

Upvotes: 2

Views: 1272

Answers (1)

Suresh Atta
Suresh Atta

Reputation: 121998

checkout my code ..working like a charm..

   <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 user_name user_password

          </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>

Upvotes: 1

Related Questions