2016-11-12 5 views
3

Open SAML 라이브러리 v3을 사용하는 예는 있습니까? 어떤 설명서도 찾을 수 없으며 https://wiki.shibboleth.net/confluence/display/OpenSAML/Home에 따라 v2는 EOL입니다. 내가 SAML을 얻기 위해 다음 코드를 사용하고opensaml v3를 사용하는 방법? 문서가 거의 없으며 v2는 EOL입니다

이 문제는 내가 unmarshaller에 대한 null를 얻고 있다는 것입니다

private UnmarshallerFactory unmarshallerFactory; 
    private DocumentBuilder docBuilder; 

    @PostConstruct 
    public void init() { 

    try { 
     InitializationService.initialize(); 
     DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); 
     documentBuilderFactory.setNamespaceAware(true); 
     docBuilder = documentBuilderFactory.newDocumentBuilder(); 
     unmarshallerFactory = XMLObjectProviderRegistrySupport.getUnmarshallerFactory(); 
    } catch (Exception e){ 
     logger.error("Error: ",e); 
    } 
    } 

    public Assertion getSamlAssertion(String samlResponse) 
     throws IOException, XMLParserException, UnmarshallingException, SAXException { 

    Document document = docBuilder.parse(new StringInputStream(samlResponse)); 

    Element element = document.getDocumentElement(); 
    Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element); 
    XMLObject responseXmlObj = unmarshaller.unmarshall(element); 
    Response response = (Response) responseXmlObj; 
    return response.getAssertions().get(0); 

    } 

내 POM-

  <dependency> 
      <groupId>org.opensaml</groupId> 
      <artifactId>opensaml-core</artifactId> 
      <version>3.2.0</version> 
     </dependency> 


     <dependency> 
      <groupId>org.opensaml</groupId> 
      <artifactId>opensaml-saml-api</artifactId> 
      <version>3.2.0</version> 
     </dependency> 

assertion-. samlResponse이 유효 함을 확인했습니다.

+0

downvoter- 내가이 질문을 설명하기 위해 무엇을 더 잘 할 수 있었는지 설명해 주실 수 있습니까? – gauravphoenix

+0

동의합니다.이 라이브러리에서 "시작하기"가이드를 찾을 수 없습니다. – Alic

답변

2

POM에 구현을 포함해야합니다.

버전 3에서 수행되는 작업 중 하나는 라이브러리를 다양한 모듈로 분할하는 것입니다.

예, 문서가 문제입니다. 그러나 내가 알고 있듯이 개발자 팀은이를 알고 있습니다. 그 사이에, 나는 주제에 관한 책인 A Guide to OpenSAML V3을 썼다. OpenSAML의 사용과 V3의 변화를 살펴 봅니다.