Package org.opensaml.saml.saml2.profile
Class SAML2ActionTestingSupport
- java.lang.Object
-
- org.opensaml.saml.saml2.profile.SAML2ActionTestingSupport
-
public class SAML2ActionTestingSupport extends Object
Helper methods for creating/testing SAML 2 objects within profile action tests. When methods herein refer to mock objects they are always objects that have been created via Mockito unless otherwise noted.
-
-
Field Summary
Fields Modifier and Type Field Description static StringASSERTION_IDID used for all generatedAssertionobjects.static StringREQUEST_IDID used for all generatedResponseobjects.static StringRESPONSE_IDID used for all generatedResponseobjects.
-
Constructor Summary
Constructors Constructor Description SAML2ActionTestingSupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.opensaml.saml.saml2.core.ArtifactResolvebuildArtifactResolve(String artifact)Builds aArtifactResolve.static org.opensaml.saml.saml2.core.ArtifactResponsebuildArtifactResponse()Builds an empty artifact response.static org.opensaml.saml.saml2.core.AssertionbuildAssertion()Builds an empty assertion.static org.opensaml.saml.saml2.core.AttributeQuerybuildAttributeQueryRequest(org.opensaml.saml.saml2.core.Subject subject)Builds anAttributeQuery.static org.opensaml.saml.saml2.core.AttributeStatementbuildAttributeStatement()Builds an empty attribute statement.static org.opensaml.saml.saml2.core.AuthnRequestbuildAuthnRequest()Builds anAuthnRequest.static org.opensaml.saml.saml2.core.AuthnStatementbuildAuthnStatement()Builds an authentication statement.static org.opensaml.saml.saml2.core.IssuerbuildIssuer(String entityID)Builds aIssuer.static org.opensaml.saml.saml2.core.LogoutRequestbuildLogoutRequest(org.opensaml.saml.saml2.core.NameID name)Builds anLogoutRequest.static org.opensaml.saml.saml2.core.LogoutResponsebuildLogoutResponse()Builds an empty logout response.static org.opensaml.saml.saml2.core.NameIDbuildNameID(String principalName)Builds aNameID.static org.opensaml.saml.saml2.core.ResponsebuildResponse()Builds an empty response.static org.opensaml.saml.saml2.core.ScopingbuildScoping(Integer count, Set<String> idplist)Build aScoping.static org.opensaml.saml.saml2.core.SubjectbuildSubject(String principalName)Builds aSubject.
-
-
-
Field Detail
-
REQUEST_ID
public static final String REQUEST_ID
ID used for all generatedResponseobjects.- See Also:
- Constant Field Values
-
RESPONSE_ID
public static final String RESPONSE_ID
ID used for all generatedResponseobjects.- See Also:
- Constant Field Values
-
ASSERTION_ID
public static final String ASSERTION_ID
ID used for all generatedAssertionobjects.- See Also:
- Constant Field Values
-
-
Method Detail
-
buildResponse
@Nonnull public static org.opensaml.saml.saml2.core.Response buildResponse()
Builds an empty response. The ID of the message isActionTestingSupport.OUTBOUND_MSG_ID, the issue instant is 1970-01-01T00:00:00Z and the SAML version isSAMLVersion.VERSION_11.- Returns:
- the constructed response
-
buildArtifactResponse
@Nonnull public static org.opensaml.saml.saml2.core.ArtifactResponse buildArtifactResponse()
Builds an empty artifact response. The ID of the message isActionTestingSupport.OUTBOUND_MSG_ID, the issue instant is 1970-01-01T00:00:00Z and the SAML version isSAMLVersion.VERSION_11.- Returns:
- the constructed response
-
buildLogoutRequest
@Nonnull public static org.opensaml.saml.saml2.core.LogoutRequest buildLogoutRequest(@Nullable org.opensaml.saml.saml2.core.NameID name)Builds anLogoutRequest. If aNameIDis given, it will be added to the constructedLogoutRequest.- Parameters:
name- the NameID to add to the request- Returns:
- the built request
-
buildLogoutResponse
@Nonnull public static org.opensaml.saml.saml2.core.LogoutResponse buildLogoutResponse()
Builds an empty logout response. The ID of the message isActionTestingSupport.OUTBOUND_MSG_ID, the issue instant is 1970-01-01T00:00:00Z and the SAML version isSAMLVersion.VERSION_11.- Returns:
- the constructed response
-
buildAssertion
@Nonnull public static org.opensaml.saml.saml2.core.Assertion buildAssertion()
Builds an empty assertion. The ID of the message isASSERTION_ID, the issue instant is 1970-01-01T00:00:00Z and the SAML version isSAMLVersion.VERSION_11.- Returns:
- the constructed assertion
-
buildAuthnStatement
@Nonnull public static org.opensaml.saml.saml2.core.AuthnStatement buildAuthnStatement()
Builds an authentication statement. The authn instant is set to 1970-01-01T00:00:00Z.- Returns:
- the constructed statement
-
buildAttributeStatement
@Nonnull public static org.opensaml.saml.saml2.core.AttributeStatement buildAttributeStatement()
Builds an empty attribute statement.- Returns:
- the constructed statement
-
buildSubject
@Nonnull public static org.opensaml.saml.saml2.core.Subject buildSubject(@Nullable String principalName)Builds aSubject. If a principal name is given aNameID, whose value is the given principal name, will be created and added to theSubject.- Parameters:
principalName- the principal name to add to the subject- Returns:
- the built subject
-
buildNameID
@Nonnull public static org.opensaml.saml.saml2.core.NameID buildNameID(@Nonnull @NotEmpty String principalName)Builds aNameID.- Parameters:
principalName- the principal name to use in the NameID- Returns:
- the built NameID
-
buildIssuer
@Nonnull public static org.opensaml.saml.saml2.core.Issuer buildIssuer(@Nonnull @NotEmpty String entityID)Builds aIssuer.- Parameters:
entityID- the entity ID to use in the Issuer- Returns:
- the built Issuer
-
buildAttributeQueryRequest
@Nonnull public static org.opensaml.saml.saml2.core.AttributeQuery buildAttributeQueryRequest(@Nullable org.opensaml.saml.saml2.core.Subject subject)Builds anAttributeQuery. If aSubjectis given, it will be added to the constructedAttributeQuery.- Parameters:
subject- the subject to add to the query- Returns:
- the built query
-
buildAuthnRequest
@Nonnull public static org.opensaml.saml.saml2.core.AuthnRequest buildAuthnRequest()
Builds anAuthnRequest.- Returns:
- the built request
-
buildScoping
@Nonnull public static org.opensaml.saml.saml2.core.Scoping buildScoping(@Nullable Integer count, @Nullable @NonnullElements Set<String> idplist)Build aScoping.- Parameters:
count- proxy countidplist- list of IdP entityIDs- Returns:
- populated
Scoping - Since:
- 4.0.0
-
buildArtifactResolve
@Nonnull public static org.opensaml.saml.saml2.core.ArtifactResolve buildArtifactResolve(@Nullable String artifact)Builds aArtifactResolve.- Parameters:
artifact- the artifact to add to the request- Returns:
- the built request
-
-