Skip to content

Commit b8f8fab

Browse files
committed
Document SigningMethod Support
Issue gh-8952 Issue gh-9177
1 parent aba0e90 commit b8f8fab

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/manual/src/docs/asciidoc/_includes/servlet/saml2/saml2-login.adoc

+23
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,28 @@ RelyingPartyRegistration relyingPartyRegistration = RelyingPartyRegistration.wit
684684

685685
Otherwise, you will need to specify a private key to `RelyingPartyRegistration#signingX509Credentials` so that Spring Security can sign the `<saml2:AuthnRequest>` before sending.
686686

687+
[[servlet-saml2login-sp-initiated-factory-algorithm]]
688+
By default, Spring Security will sign the `<saml2:AuthnRequest>` using `rsa-sha256`, though some asserting parties will require a different algorithm, as indicated in their metadata.
689+
690+
You can configure the algorithm based on the asserting party's <<servlet-saml2login-relyingpartyregistrationrepository,metadata using `RelyingPartyRegistrations`>>.
691+
692+
Or, you can provide it manually:
693+
694+
[source,java]
695+
----
696+
String metadataLocation = "classpath:asserting-party-metadata.xml";
697+
RelyingPartyRegistration relyingPartyRegistration = RelyingPartyRegistrations.fromMetadataLocation(metadataLocation)
698+
// ...
699+
.assertingPartyDetails((party) -> party
700+
// ...
701+
.signingAlgorithms((sign) -> sign.add(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA512))
702+
);
703+
----
704+
705+
NOTE: The snippet above uses the OpenSAML `SignatureConstants` class to supply the algorithm name.
706+
But, that's just for convenience.
707+
Since the datatype is `String`, you can supply the name of the algorithm directly.
708+
687709
[[servlet-saml2login-sp-initiated-factory-binding]]
688710
Some asserting parties require that the `<saml2:AuthnRequest>` be POSTed.
689711
This can be configured automatically via `RelyingPartyRegistrations`, or you can supply it manually, like so:
@@ -698,6 +720,7 @@ RelyingPartyRegistration relyingPartyRegistration = RelyingPartyRegistration.wit
698720
);
699721
----
700722

723+
701724
[[servlet-saml2login-sp-initiated-factory-custom-authnrequest]]
702725
==== Customizing OpenSAML's `AuthnRequest` Instance
703726

0 commit comments

Comments
 (0)