我想向我的IDP(Azure AD)发送SAML请求,但是我不知道如何发送请求。如何发送SAML请求?
首先我使用OpenSAML构建AuthRequest。我编码为一个字符串。
现在我想使用ApacheHttpClient发送请求并阅读响应,我不确定OpenSAML是否提供http发送方法,所以我的想法是现在使用Apaches HttpClient。
String encodedAuthRequest = generateAuthRequest();
String url = "http://myidp/samlendpoint";
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(url);
// add request header
request.addHeader("User-Agent", USER_AGENT);
// what is to add else?
HttpResponse response = client.execute(request);
我现在坚持,因为我不知道如何设置的要求,它需要在GET查询参数一样?saml=....
或我一定要放在身体POST编码的SAML响应。
有人可以帮助或澄清这些问题吗?从纪尧姆回答
更新:
我有这个从国内流离失所者的元数据:
<IDPSSODescriptor>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://myidp/saml2" />
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://myidp/saml2" />
我增加了一些信息到我的问题。 – Gobliins
,所以你可以使用重定向或POST绑定,这是很常见的。 – Guillaume
POST绑定将更容易,你不需要首先DEFLATE请求,只需要base64它然后将其作为表单数据(具有相同的名称SAMLRequest) – Guillaume