gpt4 book ai didi

wso2 - 无需浏览器即可针对 WSO2 Identity Server 进行身份验证并获取 SAML2 断言消息

转载 作者:行者123 更新时间:2023-12-02 22:47:49 25 4
gpt4 key购买 nike

我正在尝试设置一个使用 WSO2 IS 通过 SAML2 进行身份验证的服务提供商。现在,我们有一个用例,其中用户是需要访问服务提供商的机器(即外部程序)。由于用户是一台机器,因此没有浏览器,并且无法使用 WSO2 登录表单来完成身份验证步骤,尽管由于它仍然是用户而被赋予了用户名和密码。

我的问题是,这个非 GUI 用户如何参与 SAML2 工作流程(特别是将凭据传递给 WSO2 以获取 SAMLV2 断言消息)并访问服务提供商?

我尝试执行以下模拟,但失败了

1) curl -v -k http://localhost:8000/service_provider/login
2) Extracting the SAML message from the response:
curl --user username:password -v -k https://localhost:9443/samlsso?SAMLRequest=<ENCODED_REQUEST>

基本上,我希望得到从 WSO2 到带有 SAML 断言消息的服务提供商的重定向响应,但我得到了以下内容: https://localhost:9443/authenticationendpoint/login.do;jsessionid=7QON18982323HWIH?commonAuthCallerPath=%2Fsamlsso&forceAuth=false&passiveAuth=false&tenantDomain=carbon.super&sessionDataKey=122JhQ-JQOJ-H8123&relyingParty=test-saml2&type=samlsso&sp=test&isSaaSApp=false&authenticators=BasicAuthenticator:LOCAL ,这与人类用户使用浏览器进行身份验证时使用的 url 相同。

我还尝试按照本文中的建议使用带有“sectoken”表单参数的 HTTP-POST 绑定(bind):http://xacmlinfo.org/2015/02/12/sso-without-identity-provider-login-page/ 。但也没有成功。

我还尝试向 WSO2 的 AuthenticationAdminHttpsSoap12Endpoint 服务发出 SOAP 请求,特别是“登录”方法。我使用从 SOAP 响应中获得的 JSESSIONID 执行上述步骤,但效果是相同的。这对我来说并不奇怪,因为 WSO2 不使用 JSESSIONID 来检查您是否已经通过身份验证(至少不会尝试获取 SAML 响应)。

最佳答案

  1. 获取登录表单

请求:curl -v http://localhost:8000/service_provider/login

从响应中提取SAMLRequestSSOAuthSessionID (如果 RelayState 存在,也将其提取)

  • 使用第 1 步中提取的值向 IDP 发送 SAML 请求(在浏览器中,这将通过重定向实现)
  • 请求端点:https://<is_host>:9443/samlsso

    Verb :post
    Content-Type:application/x-www-form-urlencoded
    Parameters:[
    SAMLRequest:<value from previous step>,
    SSOAuthSessionID:<value from previous step>,
    RelayState :<value from previous step>]

    响应将给出 IS 登录页面。摘录sessionDataKey由此而来。

  • 通过提供用户名和密码登录
  • 请求端点:https://<is_host>:9443/commonauth

    Content-Type:application/x-www-form-urlencoded
    Verb :post
    Parameters: [tocommonauth:true,username:xxxx,password:xxx,sessionDataKey:<extracted from previous step>]

    从响应中提取 SAMLResponse

  • 将 SAML 响应发布到服务提供商的 ACS 网址
  • 关于wso2 - 无需浏览器即可针对 WSO2 Identity Server 进行身份验证并获取 SAML2 断言消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38648955/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com