AADSTS900561:端点仅接受POST请求收到了GET请求

问题描述

我有asp.net Web应用程序。我正在将该应用程序迁移到Azure并实现Azure AD身份验证。 AD身份验证和基于Approle的授权按预期方式工作。我从应用程序注销时遇到问题。

AAD-Sign-out-response-message

推荐的msdn-site也尝试了这些设置,但仍然遇到同样的问题。

需要帮助解决此问题!!谢谢!

我在帐户控制器中的退出方法如下

public void SignOut()
    {

        HttpContext.GetOwinContext()
        .Authentication

        .SignOut(CookieAuthenticationDefaults.AuthenticationType);

        HttpContext.GetOwinContext().Authentication.SignOut(
                 CookieAuthenticationDefaults.AuthenticationType,OpenIdConnectAuthenticationDefaults.AuthenticationType);
 
    }

Startup.cs configauth如下

public void ConfigureAuth(IAppBuilder app)
    {


        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);


        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,Authority = Authority,PostLogoutRedirectUri = redirectUri,RedirectUri = redirectUri,TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuer = true,NameClaimType = "upn",RoleClaimType = "roles",// The claim in the Jwt token where App roles are provided.
                },Notifications = new OpenIdConnectAuthenticationNotifications()
                {
                    //
                    // If there is a code in the OpenID Connect response,redeem it for an access token and refresh token,and store those away.
                    //
                    AuthorizationCodeReceived = OnAuthorizationCodeReceived,AuthenticationFailed = OnAuthenticationFailed
                }

            });

        // Configure the db context,user manager and signin manager to use a single instance per request
        app.CreatePerOwinContext(ApplicationDbContext.Create);           
        

    }

web.config,其AD配置详细信息如下

<add key="ida:ClientId" value="xxxxx-xxxx-xx-xxxx-xxxxxxx"/>
<add key="ida:Tenant" value="xxxxxx.onmicrosoft.com"/>
<add key="ida:AADInstance" value="https://login.microsoftonline.com/{0}"/>
<add key="ida:PostLogoutRedirectUri" value="https://login.microsoftonline.com/common/oauth2/v2.0/logoutsession/"/>
<add key="ida:RedirectUri" value="https://xxxxxxxx.azurewebsites.net/"/>

解决方法

我试图重新创建您的问题,如果像我一样在门户中配置了logouturl,则可以尝试将其删除然后运行程序。 enter image description here

enter image description here

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...