authorization

asp.net MVC secure root folder only for authorized users

假如想象 提交于 2020-01-07 04:44:06
问题 I am having this small extranet service where users can log in, get all sorts of info and download few files. Is it possible to secure root folder in MVC asp.net project? I am having a project where users have to log in before using any material. How ever if I use for example "/material" folder for every pdf, jpg, etc. files, other unauthorized users can see those files also. For example everybody can see this file if they type www.example.com/material/pdf-file.pdf So I want only authorized /

How can I do Authorization Policies in Laravel 5.3?

一世执手 提交于 2020-01-07 03:11:13
问题 I read here : https://laravel.com/docs/5.3/authorization#writing-policies And I tried to like this My FavoritePolicy is like this : <?php namespace App\Policies; use App\User; use App\Models\Favorite; use Illuminate\Auth\Access\HandlesAuthorization; class FavoritePolicy { use HandlesAuthorization; public function view(User $user, Favorite $favorite) { return $user->id === $favorite->user_id; } } My FavoriteController is like this : <?php use App\Models\Favorite; ... class FavoriteController

Force authorization to basic in web test for performance

梦想与她 提交于 2020-01-07 03:02:32
问题 I'm using Visual Studio 2015 for our performance testing. I'm using a web test to make a call to an API endpoint. Using fiddler and HTTPRequester I can connect to the API with no problem. When I use the webtest I receive a 401 unauthorized. The difference between the webtest and everything else is the webtest is using Authorization: Negotiate instead of Authorization: Basic. How, in Visual Studio 2015 can I force the Authorization to Basic instead of negotiate? Here is the header as the

URL-authorization and non-Asp.Net related file types

。_饼干妹妹 提交于 2020-01-07 00:30:55
问题 URL authorization only applies to Asp.Net related file types?1 But why couldn’t it also be applied to non-Asp.Net file types? Thanx 回答1: This is because of the script maps for ASP.NET. Only certain extensions are mapped into ASP.NET. The rest are handled directly by IIS. This is by design, for performance reasons. There are two ways to handle this. Duplicate your authorization rules in the web.config files in NTFS File ACLs (that is, set permissions on folders and files directly). Make sure

URL-authorization and non-Asp.Net related file types

老子叫甜甜 提交于 2020-01-07 00:29:07
问题 URL authorization only applies to Asp.Net related file types?1 But why couldn’t it also be applied to non-Asp.Net file types? Thanx 回答1: This is because of the script maps for ASP.NET. Only certain extensions are mapped into ASP.NET. The rest are handled directly by IIS. This is by design, for performance reasons. There are two ways to handle this. Duplicate your authorization rules in the web.config files in NTFS File ACLs (that is, set permissions on folders and files directly). Make sure

PHP Equivalent to Authorized ASP.NET WebMethod (AJAX)?

℡╲_俬逩灬. 提交于 2020-01-06 19:39:28
问题 It's rare, but I have to pay MS a compliment: the ASP.NET WebMethod (AJAX) authorization is a dream, regarding my desire for security and laziness. Encosia's ASP.NET page methods are only as secure as you make them absolutely fits those needs. ASP.NET is actually workable for me now. Free at last! (From the noble but disastrous AJAXControlToolkit). Anyways, the problem is, that's for work. I'm not buying the MS architecture when LAMP's out there for free. I'm new to AJAX, and I can't seem to

Not getting Authorization dialog for App Script accessing BigQuery Service

风格不统一 提交于 2020-01-06 06:48:31
问题 I am trying to fix some App Scripts which use the BigQuery "Advanced Service" to install some BigQuery jobs. The first new script I ran popped a BigQuery authorization dialog, and everything worked fine, now running hourly. The second new script ran initially, but is now failing with: { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } } This

Run IIS Application inside Website without web.config

老子叫甜甜 提交于 2020-01-06 05:53:25
问题 I have an ASP.NET Website hosted in IIS. I created an application namely "Images" under the website which points to a shared network folder which every domain has access to it. My aim is to access the images from SSRS ReportServer via URL i.e., http://URL/Images/Filename.jpg Since it's a public folder I don't want to create web.config file inside it. Can I set Windows Authentication/Authorization via IIS Settings ? Currently It is inheriting the web.config settings from its parent Website. I

Provide a custom error page for 401 (failed authorization)

≯℡__Kan透↙ 提交于 2020-01-06 04:46:13
问题 I'm using Windows Authentication. The authentication works fine (the user is loaded with it's roles). It's when authorization fails (using the Authorize ) attribute that I want to provide a custom error page. It seems like the HandleError attribute only gets invoked for thrown exceptions but not for any error status codes ( >= 300 ). Custom errors section: <customErrors mode="On" defaultRedirect="~/Error/"> <error statusCode="404" redirect="~/Error/NotFound/" /> <error statusCode="401"

How the server verifies the JWT client?

核能气质少年 提交于 2020-01-06 01:17:31
问题 We know if the JWT content is modified, the server simply finds it using the signature. But what if the JWT is stolen and used by a hacker without modifying it? How the server verifies the JWT comes from the correct client? I know the user id is inside the JWT, but still I am not sure how the server can securely makes sure the JWT comes from the client who is having the same user id that is in the JWT. 回答1: A hacker can't and won't modify the token. As the token itself is safe and is fully