Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Cas客户端没有属性_Java_Spring_Security_Spring Boot_Cas - Fatal编程技术网

Java Cas客户端没有属性

Java Cas客户端没有属性,java,spring,security,spring-boot,cas,Java,Spring,Security,Spring Boot,Cas,我正在用CAS构建SSO应用程序。在spring客户端中,CasAssertionAuthenticationToken没有属性 网上有很多样品,他们似乎对此没有问题(是否有明显的缺失?) 对于cas服务器,除了我更改了注册服务默认值以确保这不是问题之外,它的所有默认配置都是默认的。这部分看起来像这样: <bean class="org.jasig.cas.services.RegexRegisteredService"> <property name=

我正在用CAS构建SSO应用程序。在spring客户端中,
CasAssertionAuthenticationToken
没有属性

网上有很多样品,他们似乎对此没有问题(是否有明显的缺失?)

对于cas服务器,除了我更改了注册服务默认值以确保这不是问题之外,它的所有默认配置都是默认的。这部分看起来像这样:

    <bean class="org.jasig.cas.services.RegexRegisteredService">
        <property name="id" value="1"/>
        <property name="name" value="HTTP and IMAP"/>
        <property name="description" value="Allows HTTP(S) and IMAP(S)"/>
        <property name="serviceId" value="^(https?|imaps?)://.*"/>
        <property name="evaluationOrder" value="0"/>
        <property name="ignoreAttributes" value="true"/>
        <property name="attributeFilter">
            <bean class="org.jasig.cas.services.support.RegisteredServiceDefaultAttributeFilter"/>
        </property>
    </bean>
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
    <cas:user>casuser</cas:user>        
</cas:authenticationSuccess>
</cas:serviceResponse>

调试结果时,将发布3个预定义属性

在spring中,验证票证时的服务器响应如下:

    <bean class="org.jasig.cas.services.RegexRegisteredService">
        <property name="id" value="1"/>
        <property name="name" value="HTTP and IMAP"/>
        <property name="description" value="Allows HTTP(S) and IMAP(S)"/>
        <property name="serviceId" value="^(https?|imaps?)://.*"/>
        <property name="evaluationOrder" value="0"/>
        <property name="ignoreAttributes" value="true"/>
        <property name="attributeFilter">
            <bean class="org.jasig.cas.services.support.RegisteredServiceDefaultAttributeFilter"/>
        </property>
    </bean>
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
    <cas:user>casuser</cas:user>        
</cas:authenticationSuccess>
</cas:serviceResponse>

卡苏瑟
它根本不包含任何属性。无法找出缺少什么。 考虑到cas配置几乎是默认配置,这是我的spring配置(我使用spring boot配置客户端):

@配置
@顺序(SecurityProperty.ACCESS\u OVERRIDE\u顺序)
公共类安全性扩展了WebSecurity配置适配器{
@豆子
公共服务属性服务属性(){
ServiceProperties prop=新的ServiceProperties();
道具设置服务(“http://localhost:8180/j_spring_cas_security_check");
道具设置更新(正确);
返回道具;
}
@豆子
公共身份验证提供程序casAuthenticationProvider(){
CasAuthenticationProvider CasAuthenticationProvider=新的CasAuthenticationProvider();
casAuthenticationProvider.setAuthenticationUserDetailsService(authenticationUserDetailsService());
casAuthenticationProvider.setServiceProperties(serviceProperties());
setTicketValidator(ticketValidator());
casAuthenticationProvider.setKey(“测试应用程序密钥”);
返回casAuthenticationProvider;
}
@豆子
公共身份验证UserDetailsService身份验证UserDetailsService(){
返回新的TestCasAuthenticationUserDetailsService();
}
@豆子
公共票证验证人票证验证人(){
返回新的Cas20ServiceTicketValidator(“https://localhost:8443/cas");
}
@豆子
public CasAuthenticationEntryPoint CasAuthenticationEntryPoint(){
CasAuthenticationEntryPoint CasAuthenticationEntryPoint=新的CasAuthenticationEntryPoint();
casAuthenticationEntryPoint.setLoginUrl(“https://localhost:8443/cas/login");
casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
返回casAuthenticationEntryPoint;
}
@豆子
public CasAuthenticationFilter CasAuthenticationFilter()引发异常{
CasAuthenticationFilter CasAuthenticationFilter=新的CasAuthenticationFilter();
casAuthenticationFilter.setAuthenticationManager(authenticationManager());
返回casAuthenticationFilter;
}
@凌驾
受保护的无效配置(HttpSecurity http)引发异常{
http
.addFilter(casAuthenticationFilter());
http
.例外处理()
.authenticationEntryPoint(casAuthenticationEntryPoint());
http.authorizeRequests()
.anyRequest().authenticated();
}
@凌驾
受保护的无效配置(AuthenticationManagerBuilder auth)引发异常{
认证
.authenticationProvider(casAuthenticationProvider());
}
}
有谁能告诉我我遗漏的那个明显的部分是什么吗?

哇。我不敢相信。 所有这些时间都是为了一个p3!!!
TicketValidator
url必须以
/p3
结尾,以便使用cas 3.0协议和返回值。这就是变化:

    @Bean
    public TicketValidator ticketValidator() {
        return new Cas20ServiceTicketValidator("https://localhost:8443/cas/p3");
    }
文档可以更清楚一点(现在我知道了答案,但看起来很明显)。 希望这能帮助那些需要用cas配置spring安全性的人