authorization

dynamic roles on a Java EE server

不打扰是莪最后的温柔 提交于 2019-12-17 16:27:49
问题 I want to manage user and roles in a dedicated application. For example a user of this application ("customerX boss") can create a new role "customerX employee". If an employee accesses the Java EE application server (GlassFish 3) he should get the role "customerX employee". It sounds simple, but it is not supported by Java EE, because groups are mapped to roles at start-up time and the roles within the application are static. What is the best way to manage user roles at runtime in a Java EE

Configuring Fiddler to use company network's proxy?

一世执手 提交于 2019-12-17 15:36:17
问题 I'm trying to get Fiddler to work with my company's proxy. Every external request is returning 407. So far I've tried adding oSession.oRequest["Proxy-Authorization"] = "YOURCREDENTIALS"; to the customized rules where I used my USERNAME:PASSWORD in base64. Still no luck. Any ideas? Thanks. 回答1: Note: There is an answer with a higher voting available. Because of SO sorting it is below the accepted answer. I had the same problem, too, and solved it like this: Started Fiddler with it's standard

ASP.NET Web API Authorization tokens expiring early

让人想犯罪 __ 提交于 2019-12-17 11:53:25
问题 I have implemented security for my web api (individual accounts) as discussed here. I have hosted the website on godaddy (shared hosting) and its working fine. When I ask for token by using url "domain.com/token", I get the token with expiration date of within 15 days. I have set this in "StartupAuth.cs" using AccessTokenExpireTimeSpan = TimeSpan.FromDays(15) e.g.: { "access_token":"qwertyuiop.....", "token_type":"bearer", "expires_in":1209599, "userName":"user@example.com", ".issued":"Wed,

ASP.NET Web API Authorization tokens expiring early

半城伤御伤魂 提交于 2019-12-17 11:52:41
问题 I have implemented security for my web api (individual accounts) as discussed here. I have hosted the website on godaddy (shared hosting) and its working fine. When I ask for token by using url "domain.com/token", I get the token with expiration date of within 15 days. I have set this in "StartupAuth.cs" using AccessTokenExpireTimeSpan = TimeSpan.FromDays(15) e.g.: { "access_token":"qwertyuiop.....", "token_type":"bearer", "expires_in":1209599, "userName":"user@example.com", ".issued":"Wed,

Python requests library how to pass Authorization header with single token

与世无争的帅哥 提交于 2019-12-17 10:32:43
问题 I have a request URI and a token. If I use: curl -s "<MY_URI>" -H "Authorization: TOK:<MY_TOKEN>" etc., I get a 200 and view the corresponding JSON data. So, I installed requests and when I attempt to access this resource I get a 403 probably because I do not know the correct syntax to pass that token. Can anyone help me figure it out? This is what I have: import sys,socket import requests r = requests.get('<MY_URI>','<MY_TOKEN>') r. status_code I already tried: r = requests.get('<MY_URI>'

MVC role-based routing

别等时光非礼了梦想. 提交于 2019-12-17 10:32:29
问题 I have a project with 2 areas /Admin and /User. Admin's default route is /Admin/Home/Index and user's default route is /User/Home/Index . Is it possible to implement routing to make their home URL to look like /Profile/Index but to show content from /Admin/Home/Index for admins and /User/Home/Index for users? upd Finally find out how to do it context.MapRoute( "Admin", "Profile/{action}", new { area = AreaName, controller = "Home", action = "Index" }, new { RoleConstraint = new Core

How do I unit test a controller method that has the [Authorize] attribute applied?

微笑、不失礼 提交于 2019-12-17 10:23:03
问题 I've searched stackoverflow and googled four a couple of hours and still not found any solution for my "trivial" problem. If you write unit test for your filtered [Authorize] ActionResult , how do you solve the problem to fake that user is authenticated? I have a lot of ActionResult methods that are filtered with [Authorize] and I want to test all of my ActionResult methods regardless if they are filtered with [Authorize] or not. A simple example of what i mean: [TestMethod] public void

My CustomAuthorizationPolicy.Evaluate() method never fires

て烟熏妆下的殇ゞ 提交于 2019-12-17 10:02:55
问题 I create a wcf service with custom authorize and authentication as you can see: public class AuthorizationPolicy : IAuthorizationPolicy { string id = Guid.NewGuid().ToString(); public string Id { get { return this.id; } } public System.IdentityModel.Claims.ClaimSet Issuer { get { return System.IdentityModel.Claims.ClaimSet.System; } } // this method gets called after the authentication stage public bool Evaluate(EvaluationContext evaluationContext, ref object state) { // get the authenticated

Google App Scripts cannot be given Authorization or Permission

天涯浪子 提交于 2019-12-17 09:58:30
问题 Why am I not able to give permission/authorization to a Google Apps Script that I also made using the same Google account? It seems like Google doesnt trust myself to use my own Google Apps Script with my own Spreadsheet. Here is the line of code that breaks everything. If this line doesnt exist, I'm not asked for permission. var sheet = SpreadsheetApp.getActiveSheet(); So it's trying to access the spreadsheet that created this Google Apps Script, also made using my account but I cant grant

How to implement custom authentication in ASP.NET MVC 5

柔情痞子 提交于 2019-12-17 07:59:20
问题 I'm developing an ASP.NET MVC 5 application. I have an existing DB, from which I created my ADO.NET Entity Data Model. I have a table in that DB which contains "username" and "password" column, and I want to use them to implement authentication and authorization in my Webapp; I cannot create any other database or table or column and I cannot use the standard Identity authentication, because of customer's requirements. I don't need to manage signup, password changing or other stuffs: just