verify(requestMock);
}
@Test
public void testIssueDelegateWithCertWithWrongStorePass() throws Exception {
SAMLTokenIssueOperation id = new SAMLTokenIssueOperation();
CertificateVerifierConfig certificateVerifierConfig = new CertificateVerifierConfig();
certificateVerifierConfig.setTrustCertAliases(Arrays.asList("cacert"));
certificateVerifierConfig.setKeySignAlias(keySignAlias);
certificateVerifierConfig.setKeySignPwd(keySignPwd);
certificateVerifierConfig.setStorePath(storePath);
certificateVerifierConfig.setStorePwd("xxx");
id.setCertificateVerifierConfig(certificateVerifierConfig);
JAXBElement<byte[]> jX509Certificate = new JAXBElement<byte[]>(
QName.valueOf("X509Certificate"), byte[].class,
Base64Utility.decode(CERT_DATA));
X509DataType x509DataType = new X509DataType();
x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(
jX509Certificate);
JAXBElement<X509DataType> jX509DataType = new JAXBElement<X509DataType>(
QName.valueOf("X509Data"), X509DataType.class, x509DataType);
KeyInfoType keyInfoType = new KeyInfoType();
keyInfoType.getContent().add(jX509DataType);
JAXBElement<KeyInfoType> jKeyInfoType = new JAXBElement<KeyInfoType>(
QName.valueOf("KeyInfo"), KeyInfoType.class, keyInfoType);
UseKeyType useKeyType = new UseKeyType();
useKeyType.setAny(jKeyInfoType);
JAXBElement<UseKeyType> jUseKeyType = new JAXBElement<UseKeyType>(
QName.valueOf("UseKey"), UseKeyType.class, useKeyType);
JAXBElement<String> tokenType = new JAXBElement<String>(new QName(
"http://docs.oasis-open.org/ws-sx/ws-trust/200512",
"TokenType"), String.class,
"urn:oasis:names:tc:SAML:1.0:assertion");
EasyMock.expect(requestMock.getAny()).andStubReturn(
Arrays.asList((Object) jUseKeyType, (Object) tokenType));
EasyMock.replay(requestMock);
TokenProvider tp1 = new Saml1TokenProvider();
TokenProvider tp2 = new Saml2TokenProvider();
id.setTokenProviders(Arrays.asList(tp1, tp2));
try {
id.issue(requestMock, null);
fail("STSException should be thrown");
} catch (STSException e) {
// expected
} finally {
verify(requestMock);