I've recently taken interest in the CAS system for a work project using 
ASP.NET MVC applications. So I made a simple test project following MVC and 
I am now trying to link my MSSQL database (generated with Entity Framework 
of Visual Studio 2015 Pro) and my CAS so that the CAS server can check my 
project's database for users when they try to log in.

I am using CAS 4.0.1 so I've followed this tutorial: 
https://jasig.github.io/cas/4.0.x/installation/Database-Authentication.html 
which ends up looking like the following code:

In the "deployerConfigContext.xml"

<bean id="authenticationManager" 
> class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">
>     <constructor-arg>
>         <map>
>             <entry key-ref="primaryAuthenticationHandler" 
> value-ref="dbAuthHandler"/>
>         </map>
>     </constructor-arg>
>     <property name="authenticationPolicy">
>         <bean class="org.jasig.cas.authentication.AnyAuthenticationPolicy" 
> />
>     </property>
> </bean>
> <bean id="passwordEncoder"
>       class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"
>       c:encodingAlgorithm="MD5"
>       p:characterEncoding="UTF-8" />
> <bean id="dbAuthHandler"
>       
> class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler"
>       p:dataSource-ref="dataSource"
>       p:passwordEncoder-ref="passwordEncoder"
>       p:tableUsers="Users"
>       p:fieldUser="Username"
>       p:fieldPassword="PassWord"/>
> <bean id="dataSource"
>       class="org.apache.tomcat.jdbc.pool"
>       p:driverClass="${database.driverClass}"
>       p:jdbcUrl="${database.url}"
>       p:user="${database.user}"
>       p:password="${database.password}" />


In the "cas.properties" file

database.driverClass=com.microsoft.jdbc.sqlserver
>
> database.url=jdbc:sqlserver://localhost:59228;DatabaseName=ConnectionTest.Models.DatabaseContext
> database.user=casAdmin
> database.password=casPwd


And in the pom.xml file

    <dependencies>
>         <dependency>
>             <groupId>org.jasig.cas</groupId>
>             <artifactId>cas-server-webapp</artifactId>
>             <version>${cas.version}</version>
>             <type>war</type>
>             <scope>runtime</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.jasig.cas</groupId>
>             <artifactId>cas-server-support-jdbc</artifactId>
>             <version>${cas.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>com.microsoft.sqlserver</groupId>
>             <artifactId>sqljdbc4</artifactId>
>             <version>4.0</version>
>         </dependency>
>         <dependency>
>             <groupId>c3p0</groupId>
>             <artifactId>c3p0</artifactId>
>             <version>0.9.1.2</version>
>         </dependency>
>      <-- I tried with Tomcat JDBC driver instead of C3P0
>          but it didn't seem to have changed anything -->
>         <dependency>
>             <groupId>org.apache.tomcat</groupId>
>             <artifactId>tomcat-jdbc</artifactId>
>             <version>9.0.0.M4</version>
>         </dependency>
>     </dependencies>
>     <properties>
>         <cas.version>4.0.1</cas.version>
>     </properties>


I'm not getting any errors when building with Maven (3.3.9) nor when 
deploying with Tomcat (9.0.0.M4) but when I try to log in on the CAS with 
some of my DB's credentials it just tells me that my crendentials are 
invalid. After some advice, I've found what seems to be the correct MSSQL 
driver but I'm still not sure about the exact formatting given that I still 
cannot log in with users from my DB. I'm suspecting the database URL to be 
written with the wrong syntax but I'm not sure how to write it otherwise. 

Any help is appreciated, thanks.
Regards,

   Valentine

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/a3771230-f565-4821-a0f1-50f5dfab3ef6%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

Reply via email to