Continuation of my earlier question. I'm working on CAS 5 to modify according to my needs. With help of CAS tutorial now I've done customized authentication. Now I've added below dependency to pom.xml
to connect to database by following link.
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${cas.version}</version>
</dependency>
And added database authentication properties in application.properties
cas.authn.jdbc.query[0].sql=some query
cas.authn.jdbc.query[0].url=jdbc:postgresql://127.0.0.1/dbcas
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQLDialect
cas.authn.jdbc.query[0].user=readonly
cas.authn.jdbc.query[0].password=readonly
cas.authn.jdbc.query[0].ddlAuto=none
cas.authn.jdbc.query[0].driverClass=org.postgresql.Driver
But it's not working means getting
Type 'org.apereo.cas.configuration.model.support.jdbc.QueryJdbcAuthenticationProperties' has no property 'url'
Am I missing anything here. Any one please help me in this.
Update:
I've checked the source of QueryJdbcAuthenticationProperties
@RequiredProperty
private String sql;
And AbstractJpaProperties
private String dialect;
private String ddlAuto;
@RequiredProperty
private String driverClass;
@RequiredProperty
private String url;
@RequiredProperty
private String user;
@RequiredProperty
private String password;
I found same two classes in cas-server-core-api-configuration-model-5.3.2.jar
file and these two are not found in any other package and jar file.
What's the issue here. I'm unable to identified it.
How to know where these properties (
cas.authn.jdbc.query
) has been defined?
I thought that object has been created w.r.t child class QueryJdbcAuthenticationProperties
while defining these database properties.
When you look into the classes you describe, i. e. AbstractJpaProperties
and QueryJdbcAuthenticationProperties
, you will see something like this at their beginning:
// ...
import lombok.Getter;
import lombok.Setter;
// ...
@Getter
@Setter
public abstract class AbstractJpaProperties implements Serializable {
// ...
@RequiredProperty
private String url = "jdbc:hsqldb:mem:cas-hsql-database";
And no getters and setters for the fields. That means that Lombok takes care of generating them at compile time. If you open the class directly from cas-server-core-api-configuration-model-5.3.2.jar
, your IDE should show you the getters and setters in the class outline (in the compiled class only).
So maybe you try to build those classes (or the whole CAS?) yourself without having the Lombok library in the build path? Therefore, you get the error:
Type 'org.apereo.cas.configuration.model.support.jdbc.QueryJdbcAuthenticationProperties' has no property 'url'
If so, I would recommend you to rather use the CAS WAR Overlay Installation instead - it's generally easier for common CAS usage. If you still do need to touch those classes, you need to setup the Lombok as I mentioned above.
Finally, as Karan writes, you will also probably need to add an appropriate dependency on the PostgreSQL driver, so that you don't get NoClassDefFoundError
or similar when your application gets further in the execution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With