在asp.net web api中如何使用OAuth2而无需注册用户? [英] In asp.net web api how to use OAuth2 without having to register users?

查看:221
本文介绍了在asp.net web api中如何使用OAuth2而无需注册用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ember作为前端框架使用asp.net web api构建应用程序,该框架仅允许用户登录。我的意思是你不应该以任何方式注册。所有能够使用该应用程序的用户都将其信息(名称和密码)存储在数据库中。我希望能够做的是允许他们使用他们在数据库中的信息登录,并给他们不同的级别(用户和经理)。我经历了很多文档甚至问过朋友,我听说过OAuth2,所以我去看看,但是在所有教程中他们都谈到了注册然后获取令牌......是否有人可以告诉我如何做这或指向一个指南,说明我将如何解决这个具体问题?

I'm building an application with asp.net web api using Ember as a frontend framework which is intended to only allow users to login. What I mean is that you're not supposed to be able to register in any way. All users that will be able to use the application have their information(name and password) stored in a DB. What I want to be able to do is allow them to log in using their information from the DB and also give them different ranks (user and manager). I've through a lot of documentation and even asked friends and I heard about OAuth2 so I went to check it out but in all tutorials they talk about registering and then getting tokens... is there someone who can tell me how I can do this or point me to a guide that shows how I'll be able to solve this specific question?

推荐答案

这一切都可以在webapi网站中直接使用。要防止用户注册,您需要做的就是丢弃注册页面。

如果您从visual studio创建一个新的mvc项目,则所有内容都设置为用户授权和基于角色的授权。 OAuth是一个可配置的层。
This all works straight out of the box in a webapi site. All you need to do to prevent the users from registering is throw away the registration page.
If you create a new mvc project from visual studio everything is set up for user authorisation and role based authorisation. OAuth is a configurable layer on top of that.


这篇关于在asp.net web api中如何使用OAuth2而无需注册用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆