質問

I am working on idp-initated authentication. I want to generate SAML response to be sent to SalesForce. I have necessary values to be set in the response from metadata. Please tell me openSAML classes to use in order to generate response/assertion.

役に立ちましたか?

解決

Following are the main classes that will be used.

Assertion
Signature
SubjectConfirmationData
NameID
Subject
Conditions
Audience
AuthnContextClassRef
AuthnStatement

see this for openSAML libraries link

他のヒント

If you are looking to create SAML Assertions and want some convenience methods that will help you deal with the OpenSAML library, you can take a look at WSS4J's SAML2ComponentBuilder. This is used extensively in Apache CXF and other Java service stacks.

Creating an assertion is as easy as:

        //Create assertion
    Assertion assertion = SAML2ComponentBuilder.createAssertion();

    //create issuer
    Issuer issuer = SAML2ComponentBuilder.createIssuer(issuerString);
    assertion.setIssuer(issuer);

You can obviously set all the values described above and there is an 'AssertionWrapper' provided that assists in digitally signing the assertion:

assertionWrapper.signAssertion( alias, password, signatureCrypto, false, defaultCanonicalizationAlgorithm, defaultRSASignatureAlgorithm);

It is worth looking into if you are having difficultly dealing directly with the OpenSAML library.

Thanks, Yogesh

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top