提供的服务localhost无权使用CAS代理身份验证

时间:2015-12-06 15:46:14

标签: spring-security cas jasig

我已经创建了自己的CAS服务器和客户端。它们都位于localhost。

我添加了以下json服务定义:

{
  "@class" : "org.jasig.cas.services.RegexRegisteredService",
  "serviceId":"^(https?|imaps?)://.*",
  "name" : "localhost",
  "theme" : "localhost",
  "id" : 1,
  "description" : "localhost test CAS client",
  "proxyPolicy" : {
    "allowedToProxy": true,
    "@class" : "org.jasig.cas.services.RefuseRegisteredServiceProxyPolicy"
  },
  "evaluationOrder" : 1,
  "usernameAttributeProvider" : {
    "@class" : "org.jasig.cas.services.DefaultRegisteredServiceUsernameProvider"
  },
  "logoutType" : "BACK_CHANNEL",
  "attributeReleasePolicy" : {
    "@class" : "org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy",
    "principalAttributesRepository" : {
      "@class" : "org.jasig.cas.authentication.principal.DefaultPrincipalAttributesRepository"
    },
    "authorizedToReleaseCredentialPassword" : false,
    "authorizedToReleaseProxyGrantingTicket" : false
  },
  "accessStrategy" : {
    "@class" : "org.jasig.cas.services.DefaultRegisteredServiceAccessStrategy",
    "enabled" : true,
    "ssoEnabled" : true
  }
}

但我不断得到以下例外:

17:43:23.513 [http-nio-8443-exec-2] DEBUG o.j.c.c.v.Cas20ProxyTicketValidator - Server response: 


<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
    <cas:authenticationFailure code='UNAUTHORIZED_SERVICE_PROXY'>
            The supplied service &#039;https://localhost:8443/cas-sample/login/cas&#039; is not authorized to use CAS proxy authentication.
    </cas:authenticationFailure>
</cas:serviceResponse>

17:43:23.515 [http-nio-8443-exec-2] DEBUG o.s.s.c.web.CasAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.BadCredentialsException: 
            The supplied service 'https://localhost:8443/cas-sample/login/cas' is not authorized to use CAS proxy authentication.

我的配置有什么问题?

1 个答案:

答案 0 :(得分:1)

我通过将策略类更改为:

来实现它
  "proxyPolicy" : {
    "@class" : "org.jasig.cas.services.RegexMatchingRegisteredServiceProxyPolicy",
    "pattern" : "^https://.+"
  }