Class SAML2HTTPPostSimpleSignSecurityHandlerTest
- java.lang.Object
-
- org.opensaml.core.testing.OpenSAMLInitBaseTestCase
-
- org.opensaml.core.testing.XMLObjectBaseTestCase
-
- org.opensaml.saml.saml2.binding.security.impl.SAML2HTTPPostSimpleSignSecurityHandlerTest
-
public class SAML2HTTPPostSimpleSignSecurityHandlerTest extends XMLObjectBaseTestCase
Test SAML simple signature via HTTP POST-SimpleSign binding
-
-
Field Summary
Fields Modifier and Type Field Description private CollectionCredentialResolvercredResolverprivate StringexpectedRelayValueprivate SAML2HTTPPostSimpleSignSecurityHandlerhandlerprivate static StringINVALID_BASE64_TRAILINGInvalid base64 string as it has invalid trailing digits.private Stringissuerprivate MessageContextmessageContextprivate X509CertificateotherCert1private StringotherCert1Base64private BasicX509CredentialotherCred1private SignatureTrustEnginesignatureTrustEngineprivate X509CertificatesigningCertprivate StringsigningCertBase64private PrivateKeysigningPrivateKeyprivate StringsigningPrivateKeyBase64private BasicX509CredentialsigningX509Credprivate SignatureValidationParameterssigValParamsprivate List<Credential>trustedCredentialsprivate org.apache.velocity.app.VelocityEnginevelocityEngineVelocity template engine.-
Fields inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
builderFactory, marshallerFactory, parserPool, simpleXMLObjectQName, unmarshallerFactory
-
-
Constructor Summary
Constructors Constructor Description SAML2HTTPPostSimpleSignSecurityHandlerTest()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AuthnRequestbuildInboundSAMLMessage()protected MockHttpServletRequestbuildServletRequest()private voidpopulateRequest(MockHttpServletRequest request, String htmlContentString)Populate the HTTP servlet request object with the parameter info.protected voidsetUp()voidtestBlacklistedSignatureAlgorithm()Test blacklisted signature algorithm.voidtestFailureNoKeyInfo()Test context issuer set, valid signature with trusted credential.voidtestInvalidBase64KeyInfo()Test invalid base64 encoded KeyInfo.voidtestInvalidBase64RequestSignature()Test invalid base64 encoded signature.voidtestInvalidSignature()Test context issuer set, invalid signature with trusted credential.voidtestNoContextIssuer()Test context issuer set, valid signature with untrusted credential.voidtestNoTrustEngine()Test no trust engine supplied.voidtestSuccess()Test context issuer set, valid signature with trusted credential.voidtestSuccessNoKeyInfo()Test context issuer set, valid signature with trusted credential.voidtestUntrustedCredential()Test context issuer set, valid signature with untrusted credential.-
Methods inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
assertXMLEquals, assertXMLEquals, buildXMLObject, getBuilder, getMarshaller, getMarshaller, getUnmarshaller, getUnmarshaller, getUnmarshaller, initXMLObjectSupport, parseXMLDocument, printXML, printXML, unmarshallElement, unmarshallElement
-
Methods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase
initOpenSAML
-
-
-
-
Field Detail
-
messageContext
private MessageContext messageContext
-
handler
private SAML2HTTPPostSimpleSignSecurityHandler handler
-
signingCert
private X509Certificate signingCert
-
signingCertBase64
private String signingCertBase64
-
signingPrivateKey
private PrivateKey signingPrivateKey
-
signingPrivateKeyBase64
private String signingPrivateKeyBase64
-
otherCert1
private X509Certificate otherCert1
-
otherCert1Base64
private String otherCert1Base64
-
credResolver
private CollectionCredentialResolver credResolver
-
trustedCredentials
private List<Credential> trustedCredentials
-
signingX509Cred
private BasicX509Credential signingX509Cred
-
otherCred1
private BasicX509Credential otherCred1
-
issuer
private String issuer
-
expectedRelayValue
private String expectedRelayValue
-
signatureTrustEngine
private SignatureTrustEngine signatureTrustEngine
-
sigValParams
private SignatureValidationParameters sigValParams
-
velocityEngine
private org.apache.velocity.app.VelocityEngine velocityEngine
Velocity template engine.
-
INVALID_BASE64_TRAILING
private static final String INVALID_BASE64_TRAILING
Invalid base64 string as it has invalid trailing digits.- See Also:
- Constant Field Values
-
-
Method Detail
-
testSuccess
public void testSuccess() throws MessageHandlerExceptionTest context issuer set, valid signature with trusted credential.- Throws:
MessageHandlerException- ...
-
testBlacklistedSignatureAlgorithm
public void testBlacklistedSignatureAlgorithm() throws MessageHandlerExceptionTest blacklisted signature algorithm.- Throws:
MessageHandlerException- ...
-
testUntrustedCredential
public void testUntrustedCredential() throws MessageHandlerExceptionTest context issuer set, valid signature with untrusted credential.- Throws:
MessageHandlerException- ...
-
testInvalidSignature
public void testInvalidSignature() throws MessageHandlerExceptionTest context issuer set, invalid signature with trusted credential.- Throws:
MessageHandlerException- ...
-
testInvalidBase64RequestSignature
public void testInvalidBase64RequestSignature()
Test invalid base64 encoded signature. Should throw a MessageHandlerException with wrappedDecodingException.
-
testInvalidBase64KeyInfo
public void testInvalidBase64KeyInfo()
Test invalid base64 encoded KeyInfo. Should throw a MessageHandlerException with wrappedDecodingException.
-
testNoContextIssuer
public void testNoContextIssuer() throws MessageHandlerExceptionTest context issuer set, valid signature with untrusted credential.- Throws:
MessageHandlerException- ...
-
testSuccessNoKeyInfo
public void testSuccessNoKeyInfo() throws MessageHandlerExceptionTest context issuer set, valid signature with trusted credential.- Throws:
MessageHandlerException- ...
-
testFailureNoKeyInfo
public void testFailureNoKeyInfo() throws MessageHandlerExceptionTest context issuer set, valid signature with trusted credential.- Throws:
MessageHandlerException- ...
-
testNoTrustEngine
public void testNoTrustEngine() throws MessageHandlerExceptionTest no trust engine supplied.- Throws:
MessageHandlerException- ...
-
buildInboundSAMLMessage
protected AuthnRequest buildInboundSAMLMessage()
-
buildServletRequest
protected MockHttpServletRequest buildServletRequest()
-
populateRequest
private void populateRequest(MockHttpServletRequest request, String htmlContentString) throws XMLParserException, ComponentInitializationException
Populate the HTTP servlet request object with the parameter info. Would be nice if Spring mock object actually did this for you from populating the content string.... Oh well.- Parameters:
request- ...htmlContentString- ...- Throws:
XMLParserException- ...ComponentInitializationException- ...
-
-