相关疑难解决方法(0)

是否可以在MVC 5控制器中的一个操作上禁用身份验证过滤器?

[AuthenticateUser]
public class HomeController : Controller
{
    //
    // GET: /Home/
    public ActionResult Index()
    {
        return View();
    }

    [AllowAnonymous]
    public ActionResult List()
    {
        return View();
    }
}
Run Code Online (Sandbox Code Playgroud)

如何删除名为List的操作的身份验证?请指教....

我的自定义过滤器编码如下..我也继承了FilterAttribute调用.请告知

public class AuthenticateUserAttribute: FilterAttribute, IAuthenticationFilter
{
    public void OnAuthentication(AuthenticationContext context)
    {
        if (this.IsAnonymousAction(context))
        {

        }

        if (user == "user")
        {
            // do nothing
        }
        else
        {
            context.Result = new HttpUnauthorizedResult(); // mark unauthorized
        }
    }

    public void OnAuthenticationChallenge(AuthenticationChallengeContext context)
    {
        if (context.Result == null || context.Result is HttpUnauthorizedResult)
        {
            context.Result = …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net asp.net-mvc asp.net-mvc-5

6
推荐指数
1
解决办法
3999
查看次数

https://<myapp>.azurewebsites.net/.auth/login/aad/callback 是什么意思?

我正在使用 Azure 应用服务为我的 Web 应用程序配置身份验证。我选择使用 Express 模式的 AAD 来注册我的应用程序。

它在 AAD 上注册了我的应用程序,回复 URL 为https://.azurewebsites.net/.auth/login/aad/callback。我拦截了上述回调的 GET\ POST 请求。它发送访问令牌。

问题:我还没有在网络应用程序中实现上述reply-url 的控制器。谁处理得正确?

请让我了解一下上面的回调。如果需要的话可以更改为不同的 POST URL 吗?

c# authentication azure oauth-2.0 azure-web-app-service

5
推荐指数
1
解决办法
3325
查看次数