authorization

Identityserver4 and API in single project

孤街浪徒 提交于 2019-12-05 01:32:23
问题 I have an IdentityServer4 asp.net-core host setup for Resource Owner Password Grant using JWT Bearer tokens and an API in a separate asp.net-core host which has my API and two Angular clients. The Authentication and Authorization is working from my two Angular clients to my API. Now I need to expose an API in the IdentityServer4 host so I can create users from one of the Angular clients. I have copied my Authentication and Authorization setup from my API over to my IdentityServer4 host,

Graphql @include with expression

你离开我真会死。 提交于 2019-12-05 01:24:50
I am implementing a query which should serve some fields in the response depending on user login status. To be specific, I want to get "pointRate" field only if $authenticationToken is passed & would want to avoid passing $authenticated in below query. The reason I want to avoid sending $authenticated is client can do mistake by sending $authenticated = true but $authenticationToken = null . query ToDoQuery($authenticationToken: String, $authenticated: Boolean!) { pointRate(accessToken: $authenticationToken) @include(if: $authenticated) { status } } So, Actually you want to do that i) if

Authorization in ASP.NET Core. Always 401 Unauthorized for [Authorize] attribute

穿精又带淫゛_ 提交于 2019-12-04 23:11:12
For the first time I'm creating Authorization in ASP.NET Core. I used tutorial from here TUTORIAL The problem is when I sending request from postman: Authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6I... to my method in controller decorated with [Authorize] attribute. I receive 401 Unauthorized always... I saw comments bellow that tutorial and it seems that some people have similar issue also. I've no idea how I can solve this problem. At the request of others here is the answer: The problem was with the middleware order in Startup.cs public void Configure(IApplicationBuilder app,

How do I use cancan to authorize an array of resources?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 23:02:06
问题 I have a non-restful controller that I am trying to use the cancan authorize! method to apply permissions to. I have a delete_multiple action that starts like so def delete_multiple @invoices = apparent_user.invoices.find(params[:invoice_ids]) I want to check that the user has permission to delete all of these invoices before proceeding. If I use authorize! :delete_multiple, @invoices permission is refused. My ability.rb includes the following if user.admin? can :manage, :all elsif user

ASP.NET MVC Roles Authorization

早过忘川 提交于 2019-12-04 22:43:58
I want to make the roles default for my controller class to "Administrators, Content Editors" [Authorize(Roles = "Administrators, Content Editor")] I've done this by adorning the controller with the attribute above. However, there is one action that I want to be available to all (namely "View"). How can I reset the Roles so that everyone (including completely unauthorized users) have access for this action. Note: I know I could adorn every single action other action with the authorize attribute above but I don't want to have to do that all the time. I want all of the controllers actions to be

Building CustomAuthorization in ASP.NET MVC

旧街凉风 提交于 2019-12-04 22:37:06
In the DB i have Role and User entities with one to many relationship. What i am trying to do is to build custom authorization filter. All the tutorials that i have seen are using default ASP.NET membership. All i know is that i need to inherit AuthorizationAttribute but do not know which methods do i need to override and how to implement them. public class UserAuth : AuthorizeAttribute { } In the DB : Role public class Role { [Key] public int RoleID { get; set; } [Required] public int RolenameValue { get; set; } [MaxLength(100)] public string Description { get; set; } // // // // // public

Find the required permissions of Django URLs without calling them?

别说谁变了你拦得住时间么 提交于 2019-12-04 21:24:22
问题 My Django app currently has URLs which are protected by 'permission_required()' functions. This function is called in three different ways. As a decorator in views.py, with hardcoded parameters. As a plain function, with autogenerated parameter, in custom Class Based Generic Views. As a function invoking views in urls.py, with hardcoded parameters. I'm now adding a menu system to the app, and I need to make menu entries reflect whether the user has permission to request the URL of each menu

Google Pub/Sub push message not working for IAP enabled app engine

╄→尐↘猪︶ㄣ 提交于 2019-12-04 21:23:44
I am testing out a very basic Pub/Sub subscription. I have the push endpoint set to an App I have deployed through a Python Flex service in App Engine. The service is in a project with Identity-Aware Proxy enabled. The IAP is configured to allow through users authenticated with our domain. I do not see any of the push requests being processed by my app. I turned off the IAP protection and then I see that the requests are processed. I turn it back on and they are no longer processed. Note: This answer uses BETA commands and features. To enable IAP enabled App Engine access to Pub/Sub push

ASP.NET Authorization from Console Application & Timeout

痴心易碎 提交于 2019-12-04 20:43:55
For what its worth, I managed to get a console application to authenticate itself with an existing ASP.NET web application. It just mimics the login page by making a post request to the login page containing the viewstate information (just as if a browser had made the request). It then catches the cookie sent back in response in a CookieContainer. The application then goes on to make multiple requests to the same page (which requires authorization). The page does some work and writes out a file on the server. The problem I'm encountering is that after the phony login, the first two requests go

OAuth access and refresh token control / management on user password change

◇◆丶佛笑我妖孽 提交于 2019-12-04 20:09:58
We are in the process of developing a in house mobile application and web api. We are using asp.net web api 2 with asp.net Identy 2 OAuth. I have got the api up and running and giving me a bearer token. However I want to slightly modify the process flow to something like along the lines of this: App user logs in to api with username and password. App receives Refresh-token which is valid for 30 days. App then requests an access token providing the api with the refresh token. ( Here I want to be able to invalidate a request if the user has changed their password or their account has been locked