• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EncryptedAssertion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.saml2.core.EncryptedAssertion的典型用法代码示例。如果您正苦于以下问题:Java EncryptedAssertion类的具体用法?Java EncryptedAssertion怎么用?Java EncryptedAssertion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EncryptedAssertion类属于org.opensaml.saml2.core包,在下文中一共展示了EncryptedAssertion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: decryptAssertion

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
protected Assertion decryptAssertion(EncryptedAssertion encryptedAssertion, KeyStore.PrivateKeyEntry keystoreEntry) {
    BasicX509Credential decryptionCredential = new BasicX509Credential();

    decryptionCredential.setPrivateKey(keystoreEntry.getPrivateKey());

    StaticKeyInfoCredentialResolver resolver = new StaticKeyInfoCredentialResolver(decryptionCredential);

    ChainingEncryptedKeyResolver keyResolver = new ChainingEncryptedKeyResolver();
    keyResolver.getResolverChain().add(new InlineEncryptedKeyResolver());
    keyResolver.getResolverChain().add(new EncryptedElementTypeEncryptedKeyResolver());
    keyResolver.getResolverChain().add(new SimpleRetrievalMethodEncryptedKeyResolver());

    Decrypter decrypter = new Decrypter(null, resolver, keyResolver);
    decrypter.setRootInNewDocument(true);
    Assertion assertion = null;
    try {
        assertion = decrypter.decrypt(encryptedAssertion);
    } catch (DecryptionException e) {
        raiseSamlValidationError("Unable to decrypt SAML assertion", null);
    }
    return assertion;
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:23,代码来源:SamlHelper.java


示例2: processChildElement

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    Evidence evidence = (Evidence) parentObject;

    if (childObject instanceof AssertionIDRef) {
        evidence.getAssertionIDReferences().add((AssertionIDRef) childObject);
    } else if (childObject instanceof AssertionURIRef) {
        evidence.getAssertionURIReferences().add((AssertionURIRef) childObject);
    } else if (childObject instanceof Assertion) {
        evidence.getAssertions().add((Assertion) childObject);
    } else if (childObject instanceof EncryptedAssertion) {
        evidence.getEncryptedAssertions().add((EncryptedAssertion) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EvidenceUnmarshaller.java


示例3: processChildElement

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
@Override
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) throws UnmarshallingException 
{
    Token token = (Token) parentXMLObject;

    if(childXMLObject instanceof Assertion) 
    {
        token.setAssertion((Assertion)childXMLObject);
    }
    else if(childXMLObject instanceof EncryptedAssertion) 
    {
        token.setEncryptedAssertion((EncryptedAssertion)childXMLObject);
    }            
    else 
    {
        token.getUnknownXMLObjects().add(childXMLObject);
    }
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:19,代码来源:Token.java


示例4: encryptAssertion

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
private EncryptedAssertion encryptAssertion(boolean inline) throws NoSuchAlgorithmException, NoSuchProviderException, EncryptionException {
	Credential symmetricCredential = SecurityTestHelper.generateKeyAndCredential(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
       assertNotNull(symmetricCredential.getSecretKey());
	
       EncryptionParameters encParams = new EncryptionParameters();
       encParams.setAlgorithm(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
       encParams.setEncryptionCredential(symmetricCredential);
       
       KeyEncryptionParameters kek = new KeyEncryptionParameters();
       
       kek.setAlgorithm(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA15);
       kek.setEncryptionCredential(this.credential);
       
       
       Encrypter encrypter = new Encrypter(encParams, kek);
       if (inline) {
       	encrypter.setKeyPlacement(KeyPlacement.INLINE);
       } else {
       	encrypter.setKeyPlacement(KeyPlacement.PEER);
       }
       
       EncryptedAssertion encrypted = encrypter.encrypt(response.getAssertion().getAssertion());
	return encrypted;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:25,代码来源:OIOResponseTest.java


示例5: doEncryptedAssertion

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
@Override
public EncryptedAssertion doEncryptedAssertion(Assertion assertion, X509Credential cred, String alias, String encryptionAlgorithm) throws IdentityException {
    try {

        Credential symmetricCredential = SecurityHelper.getSimpleCredential(
                SecurityHelper.generateSymmetricKey(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256));

        EncryptionParameters encParams = new EncryptionParameters();
        encParams.setAlgorithm(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256);
        encParams.setEncryptionCredential(symmetricCredential);

        KeyEncryptionParameters keyEncryptionParameters = new KeyEncryptionParameters();
        keyEncryptionParameters.setAlgorithm(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA15);
        keyEncryptionParameters.setEncryptionCredential(cred);

        Encrypter encrypter = new Encrypter(encParams, keyEncryptionParameters);
        encrypter.setKeyPlacement(Encrypter.KeyPlacement.INLINE);

        EncryptedAssertion encrypted = encrypter.encrypt(assertion);
        return encrypted;
    } catch (Exception e) {
        throw IdentityException.error("Error while Encrypting Assertion", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:25,代码来源:DefaultSSOEncrypter.java


示例6: testEncryptedAssertion

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/**
 * Test decryption of an EncryptedAssertion.
 *  
 * @throws XMLParserException  thrown if there is an error parsing the control XML file
 * @throws EncryptionException  thrown if there is an error encrypting the control XML
 */
public void testEncryptedAssertion() throws XMLParserException, EncryptionException {
    String filename = "/data/org/opensaml/saml2/encryption/Assertion.xml";
    Document targetDOM = getDOM(filename);
    
    Assertion target = (Assertion) unmarshallElement(filename);
    EncryptedAssertion encryptedTarget = encrypter.encrypt(target);
    
    Decrypter decrypter = new Decrypter(keyResolver, null, null);
    
    SAMLObject decryptedTarget = null;
    try {
        decryptedTarget = decrypter.decrypt(encryptedTarget);
    } catch (DecryptionException e) {
        fail("Error on decryption of encrypted SAML 2 type to element: " + e);
    }
    
    assertNotNull("Decrypted target was null", decryptedTarget);
    assertTrue("Decrypted target was not the expected type", decryptedTarget instanceof Assertion);
    
    assertEquals(targetDOM, decryptedTarget);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:28,代码来源:SimpleDecryptionTest.java


示例7: testErrorInvalidDataDecryptionKey

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/**
 *  Test error condition of invalid data decryption key.
 * @throws EncryptionException 
 *  
 * @throws XMLParserException  thrown if there is an error parsing the control XML file
 * @throws EncryptionException  thrown if there is an error encrypting the control XML
 * @throws NoSuchProviderException security provider was invalid
 * @throws NoSuchAlgorithmException security/key algorithm was invalid
 */
public void testErrorInvalidDataDecryptionKey() 
        throws XMLParserException, EncryptionException, NoSuchAlgorithmException, NoSuchProviderException {
    Key badKey = SecurityTestHelper.generateKeyFromURI(encURI);
    BasicCredential encCred = new BasicCredential();
    encCred.setSecretKey((SecretKey) badKey);
    KeyInfoCredentialResolver badEncResolver = new StaticKeyInfoCredentialResolver(encCred);
    
    String filename = "/data/org/opensaml/saml2/encryption/Assertion.xml";
    
    Assertion target = (Assertion) unmarshallElement(filename);
    EncryptedAssertion encryptedTarget = encrypter.encrypt(target);
    
    Decrypter decrypter = new Decrypter(badEncResolver, null, null);
    
    SAMLObject decryptedTarget = null;
    try {
        decryptedTarget = decrypter.decrypt(encryptedTarget);
        fail("Decryption should have failed due to bad decryption key");
    } catch (DecryptionException e) {
        // do nothing, should faile
    }
    
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:33,代码来源:SimpleDecryptionTest.java


示例8: testAutoKeyGen

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** Test that a data encryption key is auto-generated if it is not supplied. */
public void testAutoKeyGen() {
    Assertion target = (Assertion) unmarshallElement("/data/org/opensaml/saml2/encryption/Assertion.xml");
    
    encParams.setEncryptionCredential(null);
    
    kekParamsList.add(kekParamsRSA);
    
    encrypter = new Encrypter(encParams, kekParamsList);
    
    XMLObject encObject = null;
    try {
        encObject = encrypter.encrypt(target);
    } catch (EncryptionException e) {
        fail("Object encryption failed: " + e);
    }
    
    assertNotNull("Encrypted object was null", encObject);
    assertTrue("Encrypted object was not an instance of the expected type", 
            encObject instanceof EncryptedAssertion);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:SimpleEncryptionTest.java


示例9: testSingleEKNoRecipients

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** No recipients specified to resolver, one EncryptedKey in instance. */
public void  testSingleEKNoRecipients() {
    String filename = 
        "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverSingleNoRecipient.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().clear();
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 1, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:20,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例10: testSingleEKMultiRecipientWithImplicitMatch

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** Multiple recipients specified to resolver, one EncryptedKey in instance with no recipient. */
public void  testSingleEKMultiRecipientWithImplicitMatch() {
    String filename = 
        "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverSingleNoRecipient.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().add("foo");
    resolver.getRecipients().add("bar");
    resolver.getRecipients().add("baz");
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 1, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例11: testSingleEKOneRecipientWithMatch

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** One recipient specified to resolver, one matching EncryptedKey in instance. */
public void  testSingleEKOneRecipientWithMatch() {
    String filename = 
        "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverSingleWithRecipient.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().add("foo");
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 1, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:20,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例12: testSingleEKOneRecipientNoMatch

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** One recipient specified to resolver, zero matching EncryptedKey in instance. */
public void  testSingleEKOneRecipientNoMatch() {
    String filename = 
        "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverSingleWithRecipient.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().add("bar");
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 0, resolved.size());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例13: testMultiEKNoRecipients

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** No recipients specified to resolver. */
public void  testMultiEKNoRecipients() {
    String filename = "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverMultiple.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().clear();
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 4, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(1) == allKeys.get(1));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(2) == allKeys.get(2));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(3) == allKeys.get(3));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例14: testMultiEKOneRecipientWithMatch

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** One recipient specified to resolver, one matching & and one recipient-less 
 *  EncryptedKey in instance. */
public void  testMultiEKOneRecipientWithMatch() {
    String filename = "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverMultiple.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().clear();
    
    resolver.getRecipients().add("foo");
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 2, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(1) == allKeys.get(2));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:23,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例15: testMultiEKOneRecipientWithMatches

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** Multi recipient specified to resolver, several matching EncryptedKey in instance. */
public void  testMultiEKOneRecipientWithMatches() {
    String filename = "/data/org/opensaml/saml2/encryption/EncryptedElementTypeEncryptedKeyResolverMultiple.xml";
    EncryptedAssertion encAssertion = (EncryptedAssertion) unmarshallElement(filename);
    
    assertNotNull(encAssertion.getEncryptedData());
    EncryptedData encData = encAssertion.getEncryptedData();
    
    List<EncryptedKey> allKeys = encAssertion.getEncryptedKeys();
    assertFalse(allKeys.isEmpty());
    
    resolver.getRecipients().add("foo");
    resolver.getRecipients().add("baz");
    
    List<EncryptedKey> resolved = generateList(encData, resolver);
    assertEquals("Incorrect number of resolved EncryptedKeys found", 3, resolved.size());
    
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(0) == allKeys.get(0));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(1) == allKeys.get(2));
    assertTrue("Unexpected EncryptedKey instance found", resolved.get(2) == allKeys.get(3));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:EncryptedElementTypeEncryptedKeyResolverTest.java


示例16: testChildElementsMarshall

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    Advice advice = (Advice) buildXMLObject(Advice.DEFAULT_ELEMENT_NAME);
    
    advice.getChildren().add(buildXMLObject(AssertionIDRef.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(AssertionURIRef.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(AssertionIDRef.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(AssertionURIRef.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(AssertionIDRef.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(EncryptedAssertion.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME));
    advice.getChildren().add(buildXMLObject(EncryptedAssertion.DEFAULT_ELEMENT_NAME));

    assertEquals(expectedChildElementsDOM, advice);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:AdviceTest.java


示例17: decrypt

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/**
 * Decrypt an assertion using the privkey stored in SPConfig.
 */
private Assertion decrypt(EncryptedAssertion encrypted)
    throws DecryptionException
{
    if (spConfig.getPrivateKey() == null)
        throw new DecryptionException("Encrypted assertion found but no SP key available");
    BasicCredential cred = new BasicCredential();
    cred.setPrivateKey(spConfig.getPrivateKey());
    StaticKeyInfoCredentialResolver resolver =
        new StaticKeyInfoCredentialResolver(cred);
    Decrypter decrypter =
        new Decrypter(null, resolver, new InlineEncryptedKeyResolver());
    decrypter.setRootInNewDocument(true);

    return decrypter.decrypt(encrypted);
}
 
开发者ID:lastpass,项目名称:saml-sdk-java,代码行数:19,代码来源:SAMLClient.java


示例18: retrieveAllAssertions

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/**
 * Retrieve all assertions, normal ones and encrypted ones if a private key was provided.
 * 
 * @param samlResponse
 *            the saml response containing the assertions.
 * @return the list of all assertions.
 * @throws DecryptionException
 *             in case of decryption problem.
 * @throws UnsupportedSamlOperation
 */
protected List<Assertion> retrieveAllAssertions(final Response samlResponse) throws DecryptionException,
		UnsupportedSamlOperation {
	final List<Assertion> allAssertions = new ArrayList<Assertion>();

	if (samlResponse != null) {
		// Normal Assertions
		final List<Assertion> normalAssertions = samlResponse.getAssertions();
		if (!CollectionUtils.isEmpty(normalAssertions)) {
			allAssertions.addAll(normalAssertions);
		}

		// Encrypted Assertions
		final List<EncryptedAssertion> encAssertions = samlResponse.getEncryptedAssertions();
		if (!CollectionUtils.isEmpty(encAssertions)) {
			for (final EncryptedAssertion encAssertion : samlResponse.getEncryptedAssertions()) {
				final Assertion assertion = this.decryptAssertion(encAssertion);

				allAssertions.add(assertion);
			}
		}
	}

	return allAssertions;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:35,代码来源:AuthnResponseQueryProcessor.java


示例19: decryptAssertion

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
/**
 * Decrypt an encrypted assertion.
 * 
 * @param encAssertion
 * @throws DecryptionException
 * @throws UnsupportedSamlOperation
 */
private Assertion decryptAssertion(final EncryptedAssertion encAssertion) throws DecryptionException,
		UnsupportedSamlOperation {
	Assertion assertion = null;

	if (encAssertion != null) {
		final ISaml20SpProcessor spProcessor = this.getSpProcessor();
		final Decrypter decrypter = spProcessor.getDecrypter();

		assertion = (Assertion) decrypter.decryptData(encAssertion.getEncryptedData(), true);

		if (this.logger.isDebugEnabled()) {
			try {
				this.logger.debug("Decrypted Assertion: [{}]", OpenSamlHelper.marshallXmlObject(assertion));
			} catch (final MarshallingException e) {
				this.logger.error("Unable to marshall decrypted Assertion for debugging purpose !");
			}
		}
	}

	return assertion;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:29,代码来源:AuthnResponseQueryProcessor.java


示例20: testIsAssertionEncrypted

import org.opensaml.saml2.core.EncryptedAssertion; //导入依赖的package包/类
@Test
public void testIsAssertionEncrypted() {
    Response samlResponse = Mockito.mock(Response.class);
    Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(null);

    boolean result = samlHelper.isAssertionEncrypted(samlResponse);
    Assert.assertFalse(result);

    Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(new ArrayList<EncryptedAssertion>());
    result = samlHelper.isAssertionEncrypted(samlResponse);
    Assert.assertFalse(result);

    EncryptedAssertion encryptedAssertion = Mockito.mock(EncryptedAssertion.class);
    List<EncryptedAssertion> assertionList = new ArrayList<EncryptedAssertion>();
    assertionList.add(encryptedAssertion);

    Mockito.when(samlResponse.getEncryptedAssertions()).thenReturn(assertionList);
    result = samlHelper.isAssertionEncrypted(samlResponse);
    Assert.assertTrue(result);
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:21,代码来源:SamlHelperTest.java



注:本文中的org.opensaml.saml2.core.EncryptedAssertion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BoltAckInfo类代码示例发布时间:2022-05-22
下一篇:
Java TenantContext类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap