authorization

Registering and login users in Azure Mobile Services

陌路散爱 提交于 2019-12-03 14:41:41
I was following this series about Mobile Services and I am using examples in latest tutorial. Now I want to impelement registering and login in Windows Phone for example. I changed to Insert permission to anyone with application key and I can Insert new user by this code: await accountTable.InsertAsync(new accounts() { Username = "admin", Password = "mypassword" }); But I don't know how can I now check for login user? How to get token? The post you referred was written at the end of last year, when there was no support for custom APIs on Azure Mobile Services - the only place where you could

ASP.NET MVC How to manage user content using ASP.NET Membership Provider

时光毁灭记忆、已成空白 提交于 2019-12-03 14:28:06
I come from 5 years of experience with ASP.NET Web Forms, and I'm new to ASP.NET MVC. I'm now trying to learn MVC with some tutorials, video tutorials, and books. I'm using Visual Studio 2012 and the brand new ASP.NET MVC 4 to build a little web application to manage my portfolio of mutual funds. This should let me get inside the new pattern and learn lots of new things... My application should also let some other friends to do the same. So it has to manage different users' portfolios . I've built a little DB with Entity Framework Code First, so I have some basic models: Fund, Portfolio, Share

Devise/Rails - How to allow only admin to create account for others?

假装没事ソ 提交于 2019-12-03 13:53:20
问题 I am using devise as my authentication solution and now i am thinking about authorization. In my project I (the admin) is the only person authorized to create account for others. I wonder if there is a way to do it without to much hack. In fact, Devise doesn't allow user to access to the signup page if he is already logged in. Thanks for your advice on it! 回答1: You can try the rails_admin gem in conjunction with Devise to handle any admin-specific tasks. You'll need to add more code to set it

Authorization in GraphQL servers

人走茶凉 提交于 2019-12-03 13:18:13
How to handle Authorization in GraphQL servers? Shall I pass the JWT token in the Authentication header of every requests and check for the authorized user after resolve() and check for the role of user on every query and mutation Introduction First of all, a common approach for authentication as you state is using a signed JWT that contains the id of the user making the request. Now let's have a look at the different parameters we can use when considering the authorization of a given request. who is making the request? determined by the user id mentioned above. More information about the

jax-rs rest webservice authentication and authorization

最后都变了- 提交于 2019-12-03 13:10:13
问题 I have a web application that needs to allow users using different webclients (browser, native mobile app, etc) to register. After signing in they can access restricted content or their own content (like entries they create, etc). What I did so far: I created a jax-rs rest webservice (I'm hosting my application on glassfish) that exposes the following methods: register - user POST's his desired username/password/email/etc; if username/email is unique, an entry for this user is created in the

WEB API - Authorize at controller or action level (no authentication)

不问归期 提交于 2019-12-03 13:03:34
I have an existing API that has No Authentication. It`s a public Web API which several clients use by making simple requests. Now, there is the need to authorize access to a certain method. Is there any way to do this, keeping the rest of the controllers and respective methods "open" for the clients that already use this Web API? How can i identify if the request has permissions to access this "protected" method? What you'll need to do is add an [Authorize] attribute to the methods you want to protect optionally using the overload that accepts one or more role names that the calling user must

Unit test AuthorizationHandler

左心房为你撑大大i 提交于 2019-12-03 12:39:42
I used the resource based authorization pattern in .NET Core 2.1 as described here . The only problem that I have is I have no idea on how to test my AuthorizationHandler cleanly. Anyone here did something like that already? AuthorizationHandler sample (from the above link): public class DocumentAuthorizationHandler : AuthorizationHandler<SameAuthorRequirement, Document> { protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, SameAuthorRequirement requirement, Document resource) { if (context.User.Identity?.Name == resource.Author) { context.Succeed(requirement);

Why are `scope`-oriented actions (particularly `index` actions) treated differently in Pundit?

会有一股神秘感。 提交于 2019-12-03 12:27:57
I am writing with respect to https://github.com/elabs/pundit#scopes I am under the impression that authorization should answer the question Are you allowed access to this resource? , i.e. a true / false answer. This is the case with all actions except index , which, according to Pundit's docs, should return different ActiveRecord::Relation 's depending on who is asking. For example, an admin gets scope.all , while a regular user gets scope.where(:published => true) . app/policies/post_policy.rb class Scope < Struct.new(:user, :scope) def resolve if user.admin? scope.all else scope.where(

The proper way of implementing user login system

て烟熏妆下的殇ゞ 提交于 2019-12-03 12:27:53
问题 I want to make a user login system for the purpose of learning. I have several questions. I did some research and found that the proper way of implementing a user login system is to store the user name/id and the encrypted/hashed version of the password in the database. When a user logs in, the password is encrypted client side (MD5, SHA-1 etc.) and sent to the server where it is compared with the one in database. If they match, the user log in successfully. This implementation prevents DBAs

Apply AuthorizeAttribute to a controller class and to action simultaneously

若如初见. 提交于 2019-12-03 12:22:43
Is There one way to make a [Authorize] attibute be ignored in one action in a controller class that has a Authorize attribute? [Authorize] public class MyController : Controller { [Authorize(Users="?")]//I tried to do that and with "*", but unsuccessfuly, public ActionResult PublicMethod() { //some code } public ActionResult PrivateMethod() { //some code } } Just the PrivateMethod() should have authentication required, but it has been required too. PS: I wouldn't like to make my custom authorize filter. []'s vladimir By default it's impossible - if you set [Authorize] for controller then only