本文整理汇总了Java中org.opensaml.core.xml.io.UnmarshallerFactory类的典型用法代码示例。如果您正苦于以下问题:Java UnmarshallerFactory类的具体用法?Java UnmarshallerFactory怎么用?Java UnmarshallerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnmarshallerFactory类属于org.opensaml.core.xml.io包,在下文中一共展示了UnmarshallerFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unmarshall
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
private EncryptedAssertion unmarshall(Element element) {
UnmarshallerFactory unmarshallerFactory = XMLObjectProviderRegistrySupport.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
try {
return (EncryptedAssertion) unmarshaller.unmarshall(element);
} catch (UnmarshallingException e) {
throw new RuntimeException(e);
}
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:10,代码来源:AssertionDecrypter.java
示例2: parseTokenFromString
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
/**
* parseTokenFromString converts a raw wresult and extracts it into an assertion.
*
* @param wresult the raw token returned by the IdP
* @return an assertion
*/
public Assertion parseTokenFromString(final String wresult) {
try (final InputStream in = new ByteArrayInputStream(wresult.getBytes("UTF-8"))) {
final Document document = configBean.getParserPool().parse(in);
final Element metadataRoot = document.getDocumentElement();
final UnmarshallerFactory unmarshallerFactory = configBean.getUnmarshallerFactory();
final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
if (unmarshaller == null) {
throw new IllegalArgumentException("Unmarshaller for the metadata root element cannot be determined");
}
final RequestSecurityTokenResponse rsToken = (RequestSecurityTokenResponse) unmarshaller.unmarshall(metadataRoot);
//Get our SAML token
final List<RequestedSecurityToken> rst = rsToken.getRequestedSecurityToken();
final Assertion assertion = (Assertion) rst.get(0).getSecurityTokens().get(0);
if (assertion == null) {
LOGGER.debug("Assertion is null");
} else {
LOGGER.debug("Assertion: {}", assertion);
}
return assertion;
} catch (final Exception ex) {
LOGGER.warn(ex.getMessage());
return null;
}
}
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:35,代码来源:WsFederationHelper.java
示例3: getUnmarshallerFactory
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
public UnmarshallerFactory getUnmarshallerFactory() {
return unmarshallerFactory;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:4,代码来源:OpenSamlConfigBean.java
示例4: parseTokenFromString
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
/**
* parseTokenFromString converts a raw wresult and extracts it into an assertion.
*
* @param wresult the raw token returned by the IdP
* @param config the config
* @return an assertion
*/
public Assertion parseTokenFromString(final String wresult, final WsFederationConfiguration config) {
try (InputStream in = new ByteArrayInputStream(wresult.getBytes("UTF-8"))) {
final Document document = configBean.getParserPool().parse(in);
final Element metadataRoot = document.getDocumentElement();
final UnmarshallerFactory unmarshallerFactory = configBean.getUnmarshallerFactory();
final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
if (unmarshaller == null) {
throw new IllegalArgumentException("Unmarshaller for the metadata root element cannot be determined");
}
final RequestSecurityTokenResponse rsToken = (RequestSecurityTokenResponse) unmarshaller.unmarshall(metadataRoot);
if (rsToken == null || rsToken.getRequestedSecurityToken() == null) {
throw new IllegalArgumentException("Request security token response is null");
}
//Get our SAML token
final List<RequestedSecurityToken> rst = rsToken.getRequestedSecurityToken();
if (rst.isEmpty()) {
throw new IllegalArgumentException("No requested security token response is provided in the response");
}
final RequestedSecurityToken reqToken = rst.get(0);
if (reqToken.getSecurityTokens() == null || reqToken.getSecurityTokens().isEmpty()) {
throw new IllegalArgumentException("Requested security token response is not carrying any security tokens");
}
Assertion assertion = null;
XMLObject securityToken = reqToken.getSecurityTokens().get(0);
if (securityToken != null) {
if (securityToken instanceof EncryptedData) {
final EncryptedData encryptedData = EncryptedData.class.cast(securityToken);
securityToken = buildAssertionDecrypter(config).decryptData(encryptedData);
}
}
if (securityToken instanceof Assertion) {
assertion = Assertion.class.cast(securityToken);
}
if (assertion == null) {
throw new IllegalArgumentException("Assertion is null");
}
LOGGER.debug("Assertion: {}", assertion);
return assertion;
} catch (final Exception ex) {
LOGGER.warn(ex.getMessage());
return null;
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:55,代码来源:WsFederationHelper.java
示例5: getUnmarshallerFactory
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
public UnmarshallerFactory getUnmarshallerFactory() {
return this.unmarshallerFactory;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:4,代码来源:OpenSamlConfigBean.java
示例6: unmarshallerFactory
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
@Bean(name = "shibboleth.UnmarshallerFactory")
@DependsOn("shibboleth.OpenSAMLConfig")
public UnmarshallerFactory unmarshallerFactory() {
return XMLObjectProviderRegistrySupport.getUnmarshallerFactory();
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:6,代码来源:CoreSamlConfiguration.java
示例7: parseTokenFromString
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
/**
* parseTokenFromString converts a raw wresult and extracts it into an assertion.
*
* @param wresult the raw token returned by the IdP
* @param config the config
* @return an assertion
*/
public Assertion parseTokenFromString(final String wresult, final WsFederationConfiguration config) {
LOGGER.debug("Result token received from ADFS is [{}]", wresult);
try (InputStream in = new ByteArrayInputStream(wresult.getBytes(StandardCharsets.UTF_8))) {
LOGGER.debug("Parsing token into a document");
final Document document = configBean.getParserPool().parse(in);
final Element metadataRoot = document.getDocumentElement();
final UnmarshallerFactory unmarshallerFactory = configBean.getUnmarshallerFactory();
final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
if (unmarshaller == null) {
throw new IllegalArgumentException("Unmarshaller for the metadata root element cannot be determined");
}
LOGGER.debug("Unmarshalling the document into a security token response");
final RequestSecurityTokenResponse rsToken = (RequestSecurityTokenResponse) unmarshaller.unmarshall(metadataRoot);
if (rsToken == null || rsToken.getRequestedSecurityToken() == null) {
throw new IllegalArgumentException("Request security token response is null");
}
//Get our SAML token
LOGGER.debug("Locating list of requested security tokens");
final List<RequestedSecurityToken> rst = rsToken.getRequestedSecurityToken();
if (rst.isEmpty()) {
throw new IllegalArgumentException("No requested security token response is provided in the response");
}
LOGGER.debug("Locating the first occurrence of a requested security token in the list");
final RequestedSecurityToken reqToken = rst.get(0);
if (reqToken.getSecurityTokens() == null || reqToken.getSecurityTokens().isEmpty()) {
throw new IllegalArgumentException("Requested security token response is not carrying any security tokens");
}
Assertion assertion = null;
LOGGER.debug("Locating the first occurrence of a security token from the requested security token");
XMLObject securityToken = reqToken.getSecurityTokens().get(0);
if (securityToken instanceof EncryptedData) {
try {
LOGGER.debug("Security token is encrypted. Attempting to decrypt to extract the assertion");
final EncryptedData encryptedData = EncryptedData.class.cast(securityToken);
final Decrypter decrypter = buildAssertionDecrypter(config);
LOGGER.debug("Built an instance of [{}]", decrypter.getClass().getName());
securityToken = decrypter.decryptData(encryptedData);
} catch (final Exception e) {
throw new IllegalArgumentException("Unable to decrypt security token", e);
}
}
if (securityToken instanceof Assertion) {
LOGGER.debug("Security token is an assertion.");
assertion = Assertion.class.cast(securityToken);
}
if (assertion == null) {
throw new IllegalArgumentException("Could not extract or decrypt an assertion based on the security token provided");
}
LOGGER.debug("Extracted assertion successfully: [{}]", assertion);
return assertion;
} catch (final Exception ex) {
LOGGER.warn(ex.getMessage());
return null;
}
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:73,代码来源:WsFederationHelper.java
示例8: getUnmarshallerFactory
import org.opensaml.core.xml.io.UnmarshallerFactory; //导入依赖的package包/类
public static UnmarshallerFactory getUnmarshallerFactory() {
return XMLObjectProviderRegistrySupport.getUnmarshallerFactory();
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:Configuration.java
注:本文中的org.opensaml.core.xml.io.UnmarshallerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论