2016-09-21 5 views
0

アトリビュートをCASクライアントに取得できません。 いくつかの調査を行い、属性をCASクライアントに転送する方法を調べました。私はこの設定cas.propertiesCAS:CASクライアントにアトリビュートが表示されない

cas.principal.resolver.persondir.return.null=false 

を、私はこの依存関係を追加しました:

<dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-collections4</artifactId> 
     <version>4.1</version> 
    </dependency> 

これは私のservicesRegistry.confです:

{ 
    "services":[ 
     { 
      "id":1, 
      "serviceId":"https://localhost:8743/**", 
      "name":"HELLO_WORLD", 
      "description":"WEBAPP FOR TESTS", 
      "theme":"my_example_webapp", 
      "allowedToProxy":true, 
      "enabled":true, 
      "ssoEnabled":true, 
      "anonymousAccess":false, 
      "evaluationOrder":1, 
      "attributeReleasePolicy" : { 
       "@class" : "org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy", 
       "principalAttributesRepository" : { 
        "@class" : "org.jasig.cas.authentication.principal.DefaultPrincipalAttributesRepository" 
       }, 
       "allowedAttributes" : [ "java.util.ArrayList", [ "cn", "description", "telephoneNumber" ] ] 
      } 
     }, 

     { 
      "id":2, 
      "serviceId":"https://yahoo.com", 
      "name":"YAHOO", 
      "description":"Test service with exact match on its serviceId and optional extra attributes", 
      "extraAttributes":{ 
       "someCustomAttribute":"Custom attribute value" 
      }, 
      "evaluationOrder":2 
     } 
    ] 
} 

ldapAuthenticationHandlerは、次のようになります。

<bean id="ldapAuthenticationHandler" 
     class="org.jasig.cas.authentication.LdapAuthenticationHandler" 
       p:principalIdAttribute="cn" 
       c:authenticator-ref="authenticator"> 
      <property name="principalAttributeMap"> 
       <map> 
        <entry key="cn" value="cn" /> 
        <entry key="description" value="description" /> 
        <entry key="telephoneNumber" value="telephoneNumber" /> 
       </map> 
      </property> 
    </bean> 

そして、このように私のauthenticationHandlersResolvers

<bean id="attributeRepository" class="org.jasig.services.persondir.support.NamedStubPersonAttributeDao" 
      p:backingMap-ref="attrRepoBackingMap" /> 

<util:map id="attrRepoBackingMap"> 
     <entry key="cn" value="cn" /> 
     <entry key="description" value="description" /> 
     <entry key="telephoneNumber" value="telephoneNumber" /> 
     <entry> 
      <key><value>memberOf</value></key> 
      <list> 
       <value>faculty</value> 
       <value>staff</value> 
       <value>org</value> 
      </list> 
     </entry> 
    </util:map> 

とクライアント側の

私は(アウト nullチェックなどで編集されたバージョン)次の操作を行います:

ここ

<util:map id="authenticationHandlersResolvers"> 
    <entry key-ref="ldapAuthenticationHandler" value="#{null}" /> 
</util:map> 

そして、私のattributeRepositoryです

AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal(); 
final Map attributes = principal.getAttributes(); 
Iterator attributeNames = attributes.keySet().iterator(); 
String attributeName = (String) attributeNames.next(); 

しかし、私は属性。私は何が欠けていますか?

EDIT:

私はCas30ProxyReceivingTicketValidationFilterCas20ProxyReceivingTicketValidationFilterを変更する必要があり、別のスレッドで読むが、それは何も変更しませんでした:

<filter> 
     <filter-name>CAS Validation Filter</filter-name> 
      <filter-class>org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter</filter-class> 

     <init-param> 
      <param-name>casServerUrlPrefix</param-name> 
      <param-value>https://localhost:8943/cas</param-value> 
     </init-param> 
     <init-param> 
      <param-name>serverName</param-name> 
      <param-value>https://localhost:8743</param-value> 
     </init-param> 
     <init-param> 
      <param-name>redirectAfterValidation</param-name> 
      <param-value>true</param-value> 
     </init-param> 
     <init-param> 
      <param-name>useSession</param-name> 
      <param-value>true</param-value> 
     </init-param> 
    </filter> 

答えて

0

私の問題はservicesRegistry.confました。それは何らかの理由でうまくいかず、理由を理解できませんでした。

あなたがservicesRegistry.confファイルを使用して問題がある場合、私はあなたのdeployerConfigContext.xml内でこれを使用するお勧めします。

<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl"> 
     <property name="registeredServices"> 
      <list> 
       <bean class="org.jasig.cas.services.RegexRegisteredService" 
         p:id="5" p:name="https.all" p:description="Allow HTTPS connection" 
         p:serviceId="^https://.*" p:evaluationOrder="5" > 

        <property name="attributeReleasePolicy"> 
         <bean class="org.jasig.cas.services.ReturnAllAttributeReleasePolicy" /> 
        </property> 
       </bean> 
      </list> 
     </property> 
    </bean> 

これは正規表現^https://.*に合ったURLを持つすべてのサービスを許可します。

関連する問題