authorization

REST API Authorization & Authentication (web + mobile)

China☆狼群 提交于 2019-11-27 02:29:08
I've read about oAuth, Amazon REST API, HTTP Basic/Digest and so on but can't get it all into "single piece". This is probably the closest situation - Creating an API for mobile applications - Authentication and Authorization I would like to built API-centric website - service. So (in the beginning) I would have an API in center and website (PHP + MySQL) would connect via cURL , Android and iPhone via their network interfaces. So 3 main clients - 3 API keys. And any other developer could also develop via API interface and they would get their own API key. API actions would be accepted/rejected

Multiple HTTP Authorization headers?

浪子不回头ぞ 提交于 2019-11-27 01:27:06
问题 Is it possible to include multiple Authorization Headers in an HTTP message? Specifically, I would like to include one of Bearer token type (passing an OAuth access token) and one of Basic type (passing a base64 encoded username:password). GET /presence/alice HTTP/1.1 Host: server.example.com Authorization: Bearer mF_9.B5f-4.1JqM Authorization: Basic YXNkZnNhZGZzYWRmOlZLdDVOMVhk I see no reason this should not be possible, just wanted to vet it with the community to be sure. 回答1: This should

SVN - how to restrict user access to certain folders?

北战南征 提交于 2019-11-27 01:19:09
问题 I have an SVN repository wherein I need to give a particular user read/write access to several specific folders. Access to the folder and its children is OK, but accessing the folder's parent is not OK. Also, it's actually 2 separate folders I need this user to access -- and these 2 folders are not part of the same tree node (but eventually they are if you go up enough levels). I have access to SVN's /conf/authz , /conf/passwd , and /conf/svnserve.conf/ files. 回答1: Add the following text to

ASP.NET Web API : Correct way to return a 401/unauthorised response

拜拜、爱过 提交于 2019-11-27 01:15:07
I have an MVC webapi site that uses OAuth/token authentication to authenticate requests. All the relevant controllers have the right attributes, and authentication is working ok. The problem is that not all of the request can be authorised in the scope of an attribute - some authorisation checks have to be performed in code that is called by controller methods - what is the correct way to return a 401 unauthorised response in this case? I have tried throw new HttpException(401, "Unauthorized access"); , but when I do this the response status code is 500 and I get also get a stack trace. Even

How can we set authorization for a whole area in ASP.NET MVC?

≯℡__Kan透↙ 提交于 2019-11-27 00:40:48
问题 I've an Admin area and I want only Admins to enter the area. I considered adding the Authorized attribute to every controller in the Admin area. Isn't there an elegant solution or is this feature not there in the framework itself? EDIT: I'm sorry, I should to have mentioned this before. I'm using a custom AuthorizedAttribute derived from AuthorizeAttribute. 回答1: Web.config-based security should almost never be used in an MVC application. The reason for this is that multiple URLs can

ASP.NET MVC Authorization

梦想的初衷 提交于 2019-11-27 00:38:43
How do I achieve authorization with MVC asp.net? Use the Authorize attribute [Authorize] public ActionResult MyAction() { //stuff } You can also use this on the controller. Can pass in users or roles too. If you want something with a little more control, you could try something like this . public class CustomAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) { string[] users = Users.Split(','); if (!httpContext.User.Identity.IsAuthenticated) return false; if (users.Length > 0 && !users.Contains(httpContext.User.Identity.Name,

Accessing post or get parameters in custom authorization MVC4 Web Api

帅比萌擦擦* 提交于 2019-11-27 00:36:34
Is it possible to access post or get parameters via the HttpActionContext object? I have a set of sensors that loggs data to a web server that provides a REST api. I would like to introduce some sort of authentication/authorization by letting the sensors include their hardware id in the data and then make a lookup in a database to see if the id exists or not. Since the API provides many web api action methods I would ideally like to use a custom authorization attribute public class ApiAuthorizationFilter : AuthorizeAttribute { protected override bool IsAuthorized(HttpActionContext

Issuing “API keys” using Keycloak

穿精又带淫゛_ 提交于 2019-11-27 00:24:06
问题 My setup has three components: A backend application (Python/Flask) A frontend application (VueJS) Keycloak The frontend will use Keycloak to let users sign in and use the access tokens to authenticate requests to the backend. So far so good. Now I want third party applications to be able to make authenticated requests against the backend and I am wondering how that can be realized using Keycloak? My idea is to issue a new set of credentials for each customer. Their application then talks to

htaccess exclude one url from Basic Auth

最后都变了- 提交于 2019-11-27 00:04:44
I need to exclude one Url (or even better one prefix) from normal htaccess Basic Auth protection. Something like /callbacks/myBank or /callbacks/.* Do you have any hints how to do it? What I'm not looking for is how to exclude a file. This has to be url (as this is solution based on PHP framework, and all urls are redirected with mod_rewrite to index.php ). So there is no file under this URL. Nothing. Some of those urls are just callbacks from other services (No IP is not known so I cannot exclude based on IP) and they cannot prompt for User / Password. Current definition is as simple as:

User authentication and authorisation in ASP.NET MVC [closed]

百般思念 提交于 2019-11-26 23:48:34
问题 What is the best method for user authorisation/authentication in ASP.NET MVC? I see there are really two approaches: Use the built-in ASP.NET authorisation system. Use a custom system with my own User, Permission, UserGroup tables etc. I'd prefer the second option, because User is part of my domain model (and I have zero experience with ASP.NET's built-in stuff), but I'd really like to hear what people have been doing in this area. 回答1: There is actually a third approach. The asp.net