Package org.opensaml.saml.saml2.testing
Class SAML2ActionTestingSupport
java.lang.Object
org.opensaml.saml.saml2.testing.SAML2ActionTestingSupport
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArtifactResolvebuildArtifactResolve(String artifact) Builds aArtifactResolve.static ArtifactResponseBuilds an empty artifact response.static AssertionBuilds an empty assertion.static AttributebuildAttribute(String name, String format, Collection<String> values) Builds an attribute and values.static AttributeQuerybuildAttributeQueryRequest(Subject subject) Builds anAttributeQuery.static AttributeStatementBuilds an empty attribute statement.static AuthnRequestBuilds anAuthnRequest.static AuthnStatementBuilds an authentication statement.static AuthnStatementbuildAuthnStatement(Instant ts, String address, String classRef) Builds an authentication statement with specified timestamp and subject locality data and context class ref.static ConditionsbuildConditions(Instant notBefore, Instant notOnOrAfter, String audience) Builds aConditions, with optional content.static IssuerbuildIssuer(String entityID) Builds aIssuer.static LogoutRequestbuildLogoutRequest(NameID name) Builds anLogoutRequest.static LogoutResponseBuilds an empty logout response.static NameIDbuildNameID(String principalName) Builds aNameID.static ResponseBuilds an empty response.static ScopingbuildScoping(Integer count, Set<String> idplist) Build aScoping.static StatusbuildStatus(String codeString, String subcodeString) Builds aStatus.static SubjectbuildSubject(String principalName) Builds aSubject.static SubjectConfirmationbuildSubjectConfirmation(String method, String recipient, String address) Builds aSubjectConfirmation.
-
Field Details
-
Constructor Details
-
SAML2ActionTestingSupport
public SAML2ActionTestingSupport()
-
-
Method Details
-
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
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
- Parameters:
name- the NameID to add to the request- Returns:
- the built request
-
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
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
Builds an authentication statement. The authn instant is set to 1970-01-01T00:00:00Z.- Returns:
- the constructed statement
-
buildAuthnStatement
@Nonnull public static AuthnStatement buildAuthnStatement(@Nonnull Instant ts, @Nonnull String address, @Nonnull String classRef) Builds an authentication statement with specified timestamp and subject locality data and context class ref.- Parameters:
ts- authn timeaddress- client addressclassRef- authentication context class ref- Returns:
- the constructed statement
- Since:
- 5.2.0
-
buildAttributeStatement
Builds an empty attribute statement.- Returns:
- the constructed statement
-
buildAttribute
@Nonnull public static Attribute buildAttribute(@Nonnull String name, @Nullable String format, @Nonnull Collection<String> values) Builds an attribute and values.- Parameters:
name- attribute nameformat- name formatvalues- value collection- Returns:
- the constructed attribute
- Since:
- 5.2.0
-
buildSubject
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
Builds aNameID.- Parameters:
principalName- the principal name to use in the NameID- Returns:
- the built NameID
-
buildSubjectConfirmation
@Nonnull public static SubjectConfirmation buildSubjectConfirmation(@Nullable String method, @Nullable String recipient, @Nullable String address) Builds aSubjectConfirmation.- Parameters:
method- confirmation methodrecipient- recipient valueaddress- confirmation address- Returns:
- the built subject confirmation
- Since:
- 5.2.0
-
buildIssuer
Builds aIssuer.- Parameters:
entityID- the entity ID to use in the Issuer- Returns:
- the built Issuer
-
buildConditions
@Nonnull public static Conditions buildConditions(@Nullable Instant notBefore, @Nullable Instant notOnOrAfter, @Nullable String audience) Builds aConditions, with optional content.- Parameters:
notBefore- the NotBefore to setnotOnOrAfter- the NotOnOrAfter to setaudience- audience to place intoAudienceRestriction- Returns:
- the object
- Since:
- 5.2.0
-
buildAttributeQueryRequest
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
Builds anAuthnRequest.- Returns:
- the built request
-
buildScoping
Build aScoping.- Parameters:
count- proxy countidplist- list of IdP entityIDs- Returns:
- populated
Scoping - Since:
- 4.0.0
-
buildArtifactResolve
Builds aArtifactResolve.- Parameters:
artifact- the artifact to add to the request- Returns:
- the built request
-
buildStatus
@Nonnull public static Status buildStatus(@Nonnull String codeString, @Nullable String subcodeString) Builds aStatus.- Parameters:
codeString- status code stringsubcodeString- subcode string if any- Returns:
- the object
- Since:
- 5.2.0
-