authorization

How to invalidate .AspNet.ApplicationCookie after Adding user to Role using Asp.Net Identity 2?

我与影子孤独终老i 提交于 2019-12-03 12:21:14
I have 2 questions related to that: 1) I need to invalidate.AspNet.ApplicationCookie after Adding / Removing some remote user to Role using Asp.Net Identity 2. I Tried to use UpdateSecurityStamp, but since no password or username is changed, SecurityStamp remains same. When I use ApplicationRoleManger I can see that User roles are updated but in User.Identity Claims they stay unchanged. 2) How does .AspNet.ApplicationCookie Validation work and how can I access it? I was trying to use this code, but with no effect What is ASP.NET Identity's IUserSecurityStampStore<TUser> interface? Update: This

Angular JS $locationChangeStart get next url route object

▼魔方 西西 提交于 2019-12-03 12:04:49
I am trying to implement Authorization on my angular application, when a route is changed I want to check whether the route is authorized for user or not. I tried with $routeChangeStart but it does not prevents the event. My current code: $scope.$on('$routeChangeStart', function(event, next, current) { if(current_user.is_logged_in){ var route_object = next.route_object; if(!(route_object.route_roles)){ event.preventDefault(); } } }); Here in my next object I am getting route_object which is set in my $routeProvider var routes = object; app.config(function($routeProvider) { $routeProvider.when

Authorize WebApp to ADFS in order to access Dynamics CRM Web API

戏子无情 提交于 2019-12-03 11:40:51
问题 I have a web application that needs to speak with Dynamic CRM 365 Web API. The Dynamic CRM is configured as a Relying Party on ADFS. The server is Windows Server 2016 and everything is on premise and not on Azure. What i did to acquire a valid token are the following: 1) In ADFS went to Application Groups and add an new Server Application, took the ClientID and also generate a Client Secret for my web application. 2) Add new new user in Active Directory the webAppUser 3) Add this user as an

How to intercept 401 from Forms Authentication in ASP.NET MVC?

会有一股神秘感。 提交于 2019-12-03 11:40:47
问题 I would like to generate a 401 page if the user does not have the right permission. The user requests a url and is redirected to the login page (I have deny all anonymous in web.config). The user logs in successfully and is redirected to the original url. However, upon permission check, it is determined that the user does not have the required permission, so I would like to generate a 401. But Forms Authentication always handles 401 and redirects the user to the login page. To me, this isn't

ASP.NET MVC: Problem setting the Authorize attribute Role from a variable, requires const

孤人 提交于 2019-12-03 11:39:11
问题 I am having a problem setting the Authorize attribute Role value from a variable. The error message says it requires a const variable. When I create a const type variable it works fine but I am trying to load the value from the Web.Config file or anything else that will allow the end user to set this. I'm using integrated Windows authentication since this is an intranet only application. Is there a way to check the users role from a controller? I will use this in an if statement to

basic authorization command for curl

扶醉桌前 提交于 2019-12-03 11:31:27
问题 How do I set up the basic authorization using 64 encoded credentials ? I tried below the two commands but of no use , please suggest. curl -i -H 'Accept:application/json' Authorization:Basic <username:password> http://example.com curl -i -H 'Accept:application/json' Authorization:Basic.base64_encode(username:password) http://example.com 回答1: Use the -H header again before the Authorization:Basic things. So it will be curl -i \ -H 'Accept:application/json' \ -H 'Authorization:Basic username

Bypass or turn off [Authorize(Roles=“”)] during development?

夙愿已清 提交于 2019-12-03 11:09:20
问题 Building an MVC3 application, and TPTB want us to use their custom authorization provider. However, during development this auth provider is kind of a pain, since it will either give an error til you shut down/restart the browser, or it will require you to re-log o on every compile. For now, I just added <authentication mode="None"/> to the web.config, which works fine until I encounter an action or controller that uses the [Authorize(Roles = "Admin")] filter (it can be any role, not just

Android: What is transport and jsonFactory in GoogleIdTokenVerifier.Builder?

五迷三道 提交于 2019-12-03 10:55:14
问题 in the blow code, whats is transport and jsonFactory ? (I do not understand) https://developers.google.com/identity/sign-in/android/backend-auth#using-a-google-api-client-library import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload; import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; ... GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport /**Here**/,

Secure documents with PHP

落花浮王杯 提交于 2019-12-03 10:22:32
问题 I have a simple login / access control system to secure some restricted pages, but within these pages there are links that need to be secure, i.e. Word documents. Therefore if I keep these resources within the webroot they could accessible via a URL. What is the best method to secure these resources that are within the restricted page. I know I could password protect the folder but the user would then be challenged twice, one for the restricted page and then for the resource link. Any advice

Django TokenAuthentication missing the 'Authorization' http header

倖福魔咒の 提交于 2019-12-03 10:18:30
I'm trying to use the TokenAuthentication with one of my views. As documented in https://www.django-rest-framework.org/api-guide/authentication/ , I add the token I received from the login as an HTTP header called: 'Authorization' in the request I send. The problem is that in my unittests the authentication fails. Looking into the TokenAuthentication class I see that the header being checked is 'HTTP_AUTHORIZATION' and not 'Authorization' The view I'm using: class DeviceCreate(generics.CreateAPIView): model = Device serializer_class = DeviceSerializer authentication_classes =