本文整理了Java中org.opensaml.Configuration.getUnmarshallerFactory()
方法的一些代码示例,展示了Configuration.getUnmarshallerFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getUnmarshallerFactory()
方法的具体详情如下:
包路径:org.opensaml.Configuration
类名称:Configuration
方法名:getUnmarshallerFactory
暂无
代码示例来源:origin: cloudfoundry/uaa
private XMLObject unmarshallObject(String xmlString) throws UnmarshallingException, XMLParserException, UnsupportedEncodingException {
BasicParserPool parser = new BasicParserPool();
parser.setNamespaceAware(true);
/* Base64URL encoded */
byte bytes[] = xmlString.getBytes("utf-8");
if (bytes == null || bytes.length == 0)
throw new InsufficientAuthenticationException("Invalid assertion encoding");
Reader reader = new InputStreamReader(new ByteArrayInputStream(bytes));
Document doc = parser.parse(reader);
Element samlElement = doc.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(samlElement);
if (unmarshaller == null) {
throw new InsufficientAuthenticationException("Unsuccessful to unmarshal assertion string");
}
return unmarshaller.unmarshall(samlElement);
}
代码示例来源:origin: apache/cloudstack
public static Response decodeSAMLResponse(String responseMessage)
throws ConfigurationException, ParserConfigurationException,
SAXException, IOException, UnmarshallingException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
byte[] base64DecodedResponse = Base64.decode(responseMessage);
Document document = docBuilder.parse(new ByteArrayInputStream(base64DecodedResponse));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return (Response) unmarshaller.unmarshall(element);
}
代码示例来源:origin: org.adeptnet.auth/auth-saml
private Response parseResponse(String authnResponse) throws SAMLException {
try {
final Document doc = parsers.getBuilder()
.parse(new InputSource(new StringReader(authnResponse)));
final Element root = doc.getDocumentElement();
return (Response) Configuration.getUnmarshallerFactory()
.getUnmarshaller(root)
.unmarshall(root);
} catch (org.opensaml.xml.parse.XMLParserException | org.opensaml.xml.io.UnmarshallingException | org.xml.sax.SAXException | java.io.IOException e) {
throw new SAMLException(e);
}
}
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.hostobjects.sso
/**
* Constructing the XMLObject Object from a String
*
* @param authReqStr
* @return Corresponding XMLObject which is a SAML2 object
* @throws Exception
*/
public static XMLObject unmarshall(String authReqStr) throws Exception {
try {
doBootstrap();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(authReqStr.trim().getBytes()));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (Exception e) {
throw new Exception("Error in constructing AuthRequest from " +
"the encoded String ", e);
}
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.core
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.base.IdentityException
*/
public static XMLObject unmarshall(String xmlString) throws IdentityException {
try {
DocumentBuilderFactory documentBuilderFactory = getSecuredDocumentBuilderFactory();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(Charsets.UTF_8)));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (ParserConfigurationException | UnmarshallingException | SAXException | IOException e) {
String message = "Error in constructing XML Object from the encoded String";
throw IdentityException.error(message, e);
}
}
代码示例来源:origin: wso2/carbon-identity-framework
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.entitlement.EntitlementException
*/
public XMLObject unmarshall(String xmlString) throws EntitlementException {
try {
doBootstrap();
DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes()));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (Exception e) {
log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
throw new EntitlementException("Error in constructing XML(SAML or XACML) from the encoded String ", e);
}
}
代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.entitlement
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.entitlement.EntitlementException
*/
public XMLObject unmarshall(String xmlString) throws EntitlementException {
try {
doBootstrap();
DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes()));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (Exception e) {
log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
throw new EntitlementException("Error in constructing XML(SAML or XACML) from the encoded String ", e);
}
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.entitlement.EntitlementException
*/
public XMLObject unmarshall(String xmlString) throws EntitlementException {
try {
doBootstrap();
DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes()));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (Exception e) {
log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
throw new EntitlementException("Error in constructing XML(SAML or XACML) from the encoded String ", e);
}
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement.proxy
("UTF-8"))));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.authenticator.saml2.sso.common
.getBytes()));
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml
Document document = docBuilder.parse(inputStream);
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
/**
* Unmarshall specified DOM {@link Element} to an opensaml {@link XMLObject}
*
* @param xmlElement
* DOM element
* @param <X>
* opensaml type
* @return the opensaml object.
*/
@SuppressWarnings({ "unchecked" })
public static <X extends XMLObject> X unmarshall(Element xmlElement) {
UnmarshallerFactory unmarshallerFactory = Configuration
.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory
.getUnmarshaller(xmlElement);
try {
return (X) unmarshaller.unmarshall(xmlElement);
} catch (UnmarshallingException e) {
throw new RuntimeException("opensaml2 unmarshalling " + "error: "
+ e.getMessage(), e);
}
}
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud
Document document = docBuilder.parse(inputStream);
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
代码示例来源:origin: lastpass/saml-sdk-java
private Response parseResponse(String authnResponse)
throws SAMLException
{
try {
Document doc = parsers.getBuilder()
.parse(new InputSource(new StringReader(authnResponse)));
Element root = doc.getDocumentElement();
return (Response) Configuration.getUnmarshallerFactory()
.getUnmarshaller(root)
.unmarshall(root);
}
catch (org.opensaml.xml.parse.XMLParserException e) {
throw new SAMLException(e);
}
catch (org.opensaml.xml.io.UnmarshallingException e) {
throw new SAMLException(e);
}
catch (org.xml.sax.SAXException e) {
throw new SAMLException(e);
}
catch (java.io.IOException e) {
throw new SAMLException(e);
}
}
代码示例来源:origin: org.apache.rampart/rampart-trust
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration
.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory
.getUnmarshaller(element);
代码示例来源:origin: org.wso2.carbon.identity.agent.sso.java/org.wso2.carbon.identity.sso.agent
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.identity.core
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.base.IdentityException
*/
public static XMLObject unmarshall(String xmlString) throws IdentityException {
try {
DocumentBuilderFactory documentBuilderFactory = getSecuredDocumentBuilderFactory();
documentBuilderFactory.setIgnoringComments(true);
Document document = getDocument(documentBuilderFactory, xmlString);
if (isSignedWithComments(document)) {
documentBuilderFactory.setIgnoringComments(false);
document = getDocument(documentBuilderFactory, xmlString);
}
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (ParserConfigurationException | UnmarshallingException | SAXException | IOException e) {
String message = "Error in constructing XML Object from the encoded String";
throw IdentityException.error(message, e);
}
}
代码示例来源:origin: wso2/carbon-identity-framework
/**
* Constructing the SAML or XACML Objects from a String
*
* @param xmlString Decoded SAML or XACML String
* @return SAML or XACML Object
* @throws org.wso2.carbon.identity.base.IdentityException
*/
public static XMLObject unmarshall(String xmlString) throws IdentityException {
try {
DocumentBuilderFactory documentBuilderFactory = getSecuredDocumentBuilderFactory();
documentBuilderFactory.setIgnoringComments(true);
Document document = getDocument(documentBuilderFactory, xmlString);
if (isSignedWithComments(document)) {
documentBuilderFactory.setIgnoringComments(false);
document = getDocument(documentBuilderFactory, xmlString);
}
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (ParserConfigurationException | UnmarshallingException | SAXException | IOException e) {
String message = "Error in constructing XML Object from the encoded String";
throw IdentityException.error(message, e);
}
}
/**
* Constructing the XMLObject Object from a String
*
* @param authReqStr
* @return Corresponding XMLObject which is a SAML2 object
* @throws SAML2SSOUIAuthenticatorException
*/
public static XMLObject unmarshall(String authReqStr) throws SAML2SSOUIAuthenticatorException {
try {
doBootstrap();
DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();
Document document = getDocument(documentBuilderFactory, authReqStr);
if (isSignedWithComments(document)) {
documentBuilderFactory.setIgnoringComments(false);
document = getDocument(documentBuilderFactory, authReqStr);
}
Element element = document.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
return unmarshaller.unmarshall(element);
} catch (Exception e) {
log.error("Error in constructing AuthRequest from the encoded String", e);
throw new SAML2SSOUIAuthenticatorException("Error in constructing AuthRequest from "
+ "the encoded String ", e);
}
}
代码示例来源:origin: org.adeptnet.auth/auth-saml
final Element root = doc.getDocumentElement();
final UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
内容来源于网络,如有侵权,请联系作者删除!