-1
我在opensaml-J初學者,我想創建一個斷言委派功能我已經寫在SAML斷言,這裏的形象:SAML-based representation of capability如何在java中創建和處理saml斷言?
所以有人可以幫助我創造了圖片中顯示的斷言與opensaml-j 以及如何處理後者?
我在opensaml-J初學者,我想創建一個斷言委派功能我已經寫在SAML斷言,這裏的形象:SAML-based representation of capability如何在java中創建和處理saml斷言?
所以有人可以幫助我創造了圖片中顯示的斷言與opensaml-j 以及如何處理後者?
所以創建斷言一種方法是:
AuthnRequest authnRequest = new AuthnRequestBuilder().buildObject();
設置你的SAML 2.0請求的強制屬性。您需要決定SAML請求中的內容。
authnRequest.setID(<>));
authnRequest.setVersion(SAMLVersion.VERSION_20);
authnRequest.setIssueInstant(new DateTime());
authnRequest.setProtocolBinding(httpBinding);
authnRequest.setIssuer(issuer);
authnRequest.setNameIDPolicy(nameIdPolicy);
authnRequest.setRequestedAuthnContext(requestedAuthnContext);
authnRequest.setDestination(idpUrl);
在您發送之前,您可能需要簽名,這是通過在請求中添加簽名來完成的。
一旦你收到一個響應SMAL你可以通過驗證其簽名驗證它:
// Signature validation
Signature signature = samlResponse.getSignature();
SignatureValidator signatureValidator = new SignatureValidator(
new X509CredentialImplementation(<>);
try {
signatureValidator.validate(signature);
} catch (ValidationException e) {
LOGGER.error("XML signature is not **validate**, or there is an error during the validation operation");
return false;
}
目前尚不清楚如何以及在哪裏,你要發送的斷言。但這是基本的程序。
感謝您的幫助我真的appriciate它我只想問你關於其他標籤(Condtion,Action,AuthzDecisionStatement)我將如何創建它們?你能給我一個更詳細的例子嗎? –