authorization

Symfony 2.3 getRequest()->headers not showing Authorization Bearer Token

血红的双手。 提交于 2019-11-30 08:48:25
问题 I am passing an Authorization: Bearer { Token } as a HTTP request to my Symfony Rest Controller. My Request: GET /app_dev.php/api/members HTTP/1.1 Host: localhost Authorization: Bearer 123456789 Cache-Control: no-cache Content-Type: application/x-www-form-urlencoded Inside My controller: $this->getRequest()->headers; For some reason when I use Symfony's Request method the Authorization header isn't available to my controller. When I use PHP's getallheaders() the Authorization header shows up

Why does HttpContext.Current.User.Identity.Name return blank

∥☆過路亽.° 提交于 2019-11-30 08:27:17
问题 I created a site. It is an internal site. It is a .NET 4.0 site. I would like to grab the username using HttpContext.Current.User.Identity.Name of the person browsing the site. There isnt a login page since it is internal. I am not sure what I am missing. Do I need the following in my webconfig: <authentication mode="Windows"></authentication> <identity impersonate="true"/> <authorization> <allow users="?"/> </authorization> and this: <system.webServer> <validation

Sessions in token based authentication

倾然丶 夕夏残阳落幕 提交于 2019-11-30 08:09:49
I am building an app in PHP Lumen which returns a token upon login. I am not sure how to proceed beyond this. How am I supposed to maintain a session using these tokens? Specifically, how do I store the tokens on the client side if I am using reactjs or vanilla HTML/CSS/jQuery and send them in every request I make for the secure part of my web app? What I usually do is to keep the token in the local storage, this way I can persist the token even if the user leaves the site. localStorage.setItem('app-token', theTokenFromServer); Every time the user loads the page, the first thing I do is to

Using MVC's AuthorizeAttribute with multiple groups of Roles?

[亡魂溺海] 提交于 2019-11-30 07:41:23
What I want to do is a two-level role check on an action handler. For example, Require that the users is in at least one of the following groups: SysAdmins, Managers AND in at least one of the following groups: HR, Payroll, Executive. Initial guess was that this might be the way to do this but I don't think it is: [Authorize(Role="SysAdmins,Managers")] [Authorize(Role="HR,Payroll,Executive")] public ActionResult SomeAction() { [...] } Do I need to role my own custom Attribute to take in Role1 and Role2 or something like that? Or is there an easier/better way to do this? You'll need your own

What is the best mechanism to implement granular security (i.e. authorization) in an ASP.NET MVC application?

夙愿已清 提交于 2019-11-30 07:13:15
问题 Suppose a high-speed developer was tasked with building a banking application which would be accessed by many different people. Each person would want to access his or her own account information but would not want others to access it. I would like to know the best practice for restricting access in an MVC application so that only the user who owns the information (or an administrator) could access it. The Authorize attribute allows us to restrict by role. While this is a starting point, it

Authorization using active directory role provider MVC4

半腔热情 提交于 2019-11-30 06:44:18
I'm building a MVC4 application for internal use in a corporate enviroment. I use windows authentication, which works fine, but I'm having troubles using Active Directory groups as roles for authorization. My Web.config looks like this: <authentication mode="Windows" /> <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"> <providers> <clear /> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> </providers> </roleManager> <authorization> <deny users="?" /> </authorization> When I use User authorization

How to do role based authorization for asp.net mvc 4 web api

坚强是说给别人听的谎言 提交于 2019-11-30 05:50:35
问题 I am trying to make a secure asp.net web api. For that I have followed the below link MessageHandler for token So now each and every api request needs a token which I am supplying in the request header as below for example public class TestController : Controller { public string GetProducts() { Uri myUri = new Uri("http://localhost:420420/api/products"); WebRequest myWebRequest = WebRequest.Create(myUri); myWebRequest.Method = "GET"; myWebRequest.ContentType = "application/json"; myWebRequest

How to use authorization header PHP

若如初见. 提交于 2019-11-30 05:28:55
问题 I am trying to use an authorization header in order to use the vimeo API. It tells me to do this 'Authorization: basic ' + base64(client_id + ':' + client_secret) , which is something I can do. But nowhere on the internet does it tell me what I actually do with this code? It is not PHP, but does it go in a PHP file? If so then what function do I use on it after storing it? Does it go in an htaccess file? It is really sad how terrible any and all online documentation is on this. To summarize,

ASP.NET MVC authorization & permission to use model classes

无人久伴 提交于 2019-11-30 05:26:58
This is my first post here, so hello :) Okay, let's get to the point... I am writing my first app in ASP.NET MVC Framework and i have a problem with checking privileges to use instances of model classes (read, edit). Sample code looks like this: // Controller action [CustomAuthorize(Roles="Editor, Admin")] public ActionResult Stats(int id) { User user = userRepository.GetUser(id); if (user == null || !user.Activated || user.Removed) return View("NotFound"); else if (!user.IsCurrentSessionUserOwned) return View("NotAuthorized"); return View(user); } So far authorize attribute protects only

How to Authorize AD users with .Net Core

帅比萌擦擦* 提交于 2019-11-30 05:25:56
I'm trying to stop requests on a route using the Authorize annotation, but I can't get it to work with Active Directory. Had anyone got this working yet? [HttpGet] [Authorize(Roles = "DOMAIN\\Group A")] [Route("/")] // GET: / public IActionResult Index() { return View(); } Note: I've also tried Authorize(Roles = @"DOMAIN\\Group A") Just to give some background, I'm running Windows, Visual Studio Pro 2015 (Update 3) Heres a bit from my project.json file: "dependencies": { "Microsoft.AspNetCore.Authorization": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Server