CAS数据库身份验证不起作用 [英] CAS Database Authentication is not working

查看:707
本文介绍了CAS数据库身份验证不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继续我先前的问题。我正在研究CAS 5以根据需要进行修改。现在借助 CAS教程已经完成了自定义身份验证。现在,我已将以下依赖项添加到 pom.xml 以通过遵循链接

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>

并在 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

工作意味着获得


类型
'org.apereo.cas.configuration.model.support.jdbc.QueryJdbcAuthenticationProperties'
没有属性'url'

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.

更新:

我已经检查 QueryJdbcAuthenticationProperties

@RequiredProperty
private String sql;

AbstractJpaProperties

private String dialect;
private String ddlAuto;
@RequiredProperty
private String driverClass;
@RequiredProperty
private String url;
@RequiredProperty
private String user;
@RequiredProperty
private String password;

我在 cas-server-core-api-configuration中发现了相同的两个类-model-5.3.2.jar 文件,而在其他任何包和jar文件中都找不到这两个文件。

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.


如何知道这些属性的位置( cas.authn.jdbc.query )是否已定义

How to know where these properties (cas.authn.jdbc.query) has been defined?

我认为该对象是通过子类 QueryJdbcAuthenticationProperties ,同时定义这些数据库属性。

I thought that object has been created w.r.t child class QueryJdbcAuthenticationProperties while defining these database properties.

推荐答案

你描述,我。 e。 AbstractJpaProperties QueryJdbcAuthenticationProperties ,您将在开始时看到以下内容:

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";

并且该字段没有getter和setter方法。这意味着 Lombok 会在编译时生成它们。如果直接从 cas-server-core-api-configuration-model-5.3.2.jar 打开类,则IDE应该向您显示该类中的getter和setter大纲(仅在编译的类中)。

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).

那么也许您尝试自己构建那些类(或整个CAS?),而无需在构建路径中使用Lombok库?因此,您将收到错误:

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:


类型'org.apereo.cas.configuration.model.support.jdbc.QueryJdbcAuthenticationProperties'没有属性'url'

Type 'org.apereo.cas.configuration.model.support.jdbc.QueryJdbcAuthenticationProperties' has no property 'url'

如果是这样,我建议您宁可使用 CAS WAR重叠式安装-通常,普通的CAS使用起来更容易。如果仍然需要触摸这些类,则需要如上所述设置Lombok。

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.

最后,正如Karan所写,您可能还需要添加一个对PostgreSQL驱动程序的适当依赖,这样当应用程序进一步执行时,您就不会得到 NoClassDefFoundError 或类似的东西。

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.

这篇关于CAS数据库身份验证不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆