2015-03-09 7 views
1

Я пытаюсь получить FOM в RoleDescriptor узла провайдера файл метаданных Service (SAML 2.0), используя следующий код и библиотеки OpenSaml:OpenSaml извлечение неправильный объект RoleDescriptor

EntitiesDescriptor entityDescriptors = getConfiguration(providerId); 
List<RoleDescriptor> roleDescriptors = (List<RoleDescriptor>) entityDescriptors.getEntityDescriptors().get(0). 
      getRoleDescriptors(); 
EntityDescriptor ed = entityDescriptors.getEntityDescriptors().get(0); 
if(roleDescriptors != null && !roleDescriptors.isEmpty()){ 
    RoleDescriptor r = (RoleDescriptor) roleDescriptors.get(0); 
    return roleDescriptors.get(0).getErrorURL(); 
} 

Мой вопрос заключается в том, что переменная r Концы быть типа org.opensaml.saml2.metadata.impl.SPSSODescriptorImpl и не org.opensaml.saml2.metadata.impl.RoleDescriptorImpl

Это файл метаданных XML Я использую:

<EntityDescriptor entityID="http://mysp.com/resource"> 

    <RoleDescriptor errorURL="http://localhost:8080/dummy-sp/error.jsp"> 
    </RoleDescriptor> 

    <SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> 
     <KeyDescriptor use="encryption"> 
      <EncryptionMethod Algorithm= 
       "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"> 
      </EncryptionMethod> 
     </KeyDescriptor> 

     <AssertionConsumerService index="1" 
      isDefault="true" Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
      Location="http://localhost:8080/dummy-sp/dummysp" /> 

    </SPSSODescriptor> 

    <Organization> 
     <OrganizationName xml:lang="en">Your Service 
     </OrganizationName> 
     <OrganizationDisplayName xml:lang="en">Your 
      Service 
     </OrganizationDisplayName> 
     <OrganizationURL xml:lang="en">http://sp.example.org/ 
     </OrganizationURL> 
    </Organization> 
    <ContactPerson contactType="technical"> 
     <GivenName>Your</GivenName> 
     <SurName>Admin</SurName> 
     <EmailAddress>[email protected]</EmailAddress> 
    </ContactPerson> 

</EntityDescriptor> 

И, наконец, есть скан моего экрана отладки Eclipse:

image

http://imgur.com/01xRD5f

+0

Любое понимание по этому вопросу? – carcaret

ответ

1

Я попытался проверить свои метаданные XML с помощью метода, описанного здесь. https://wiki.surfnet.nl/display/OpenConext/Validating+SAML2+metadata

Это говорит, что элемент (после добавления пространства имен метаданных)

RoleDescriptor: Schemas validity error : Element '{urn:oasis:names:tc:SAML:2.0:metadata}RoleDescriptor': The type definition is abstract. 

В качестве спецификации SAML метаданных говорит,

Элемент RoleDescriptor является абстрактной точкой расширения, которая содержит общую описательную информацию предназначенный для обеспечения унификации обработки в разных ролях. Новые роли можно определить, расширив свой абстрактный тип RoleDescriptorType типа

Таким образом, вы не можете иметь элемент RoleDescriptor в своих метаданных xml. Либо вы должны использовать конкретную роль, описанную в спецификации (SSO Identity Provider, SSO Service Provider, Authentication Authority, Attribute Authority, Policy Decision Point, Affiliation) или расширить абстрактный RoleDescriptor.

Таким образом, по вышеуказанной причине org.opensaml.saml2.metadata.impl.RoleDescriptorImpl является абстрактным классом в opensaml, и реализации конкретных ролей расширяет этот абстрактный класс.

 Смежные вопросы

  • Нет связанных вопросов^_^