authorization

Custom cookie authentication not working after migration from ASP.NET Core 1.1 MVC to 2.0

北战南征 提交于 2019-12-05 05:39:49
I have migrated an ASP.NET Core 1.1 MVC project to ASP.NET Core 2.0 and now I note that requests to unauthorized sections of the application no longer result with a "401 Unauthorized" response but rather with a code exception leading to a response "500 internal server error". An example excerpt from the log file (John Smith is not authorized to acces the controller action he tried to access): 2018-01-02 19:58:23 [DBG] Request successfully matched the route with name '"modules"' and template '"m/{ModuleName}"'. 2018-01-02 19:58:23 [DBG] Executing action "Team.Controllers.ModulesController.Index

Rails: Using CanCan to define multiple roles depending on instances of single Model?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 05:24:29
I'm currently stuck on how to separate roles for CanCan depending on each condition that we want. In our application, there are many categories (such as math, english, history, etc.) and within each are many courses. Each user can have many different roles on each category. For example, John can be a "reader" for math, which means he can read all the courses that are in math. John can also be a "writer" for english, which means he can read all the courses in english, create a course within category english, and edit/delete only the courses he created within english. If these were the only

OAuth 2.0 authentication in HTTP Module

久未见 提交于 2019-12-05 04:38:49
Is it possible to implement OAuth(Open Authorization) 2.0 or 1.0 in HTTP Module. Why i m choosing this because, each and every request will first reaches the HTTP Module, so from that request i have to authenticate Is it possible ? If YES means , please like a related link for that Help me.. Yes, this is possible. In fact mod_auth_openidc does exactly that for Apache (and for OpenId Connect, which is a protocol built on OAuth2). More on the scenario here: https://auth0.com/blog/2014/08/22/sso-for-legacy-apps-with-auth0-openid-connect-and-apache/ I'm going to add to Eugenio's answer by saying

Role-based access control with Spring MVC

孤人 提交于 2019-12-05 04:16:50
I would like to know the best practices for the role based access control with spring. My requirements are, I will have set of roles assigned to users say, user1=admin, user2=expert user1 will have the accesses write like /admin/member-management /admin/project-management ...... for user2.... /myproject1/* so if user2 tries to access the url /admin/member-management will be redirect to authorization failure page. Sean Patrick Floyd The standard framework to use with Spring MVC is Spring Security . While it can be very complex, here's a minimal version of what you need: 4.2.2 A Minimal

Google Drive Android API returns success even after removing the app

这一生的挚爱 提交于 2019-12-05 04:03:45
I'm using the new Google Drive Android API. This is the demo code that I've copied from Google's android-samples repo . GoogleSignInAccount signInAccount = GoogleSignIn.getLastSignedInAccount(this); if (signInAccount != null && signInAccount.getGrantedScopes().containsAll(requiredScopes)) { initializeDriveClient(signInAccount); } else { ... } The issue I'm facing is, even if I remove the app from Drive, getLastSignedInAccount() is still returning the account and the operations (such as adding a file) on the accounts are still succeeding. Returning the GoogleSignInAccount object is fine, I

REST, caching, and authorizing with multiple user roles

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:55:40
We have a multi-tenant system with multiple different levels of access--sometimes even for the same user as they switch between multiple roles. We're beginning a discussion on moving over to a RESTful implementation of things. I'm just starting to get my feet wet with the whole REST thing. So how do I go about limiting access to the correct records when they access a resource, particularly when taking caching into consideration? If user A access example.com/employees they would receive a different response than user B; user A may even receive a different response as he switches to a different

How to use cancancan?

[亡魂溺海] 提交于 2019-12-05 03:17:31
问题 I want to give rights to users in my rails app. I have 'admin' who can create, update and delete all posts and comments, 'user' who can create and update only his own comments, and 'guest' who can do none of these. For this I use the gems 'devise' and 'cancancan'. I understand the 'devise' gem, but I don't understand 'cancancan'. In the class ability.rb, how can I write rights for these users (admin, user, guest)? 回答1: Cancancan lets you only define permissions for given context. This context

Authorization header not making it through in Codeception API testing

三世轮回 提交于 2019-12-05 03:10:35
I am attempting to test my Laravel 4 REST API using Codeception, but when I try to send through my Authorization header (using the $I->amBearerAuthenticated() function of the REST module) it is not making it through to the eventual request. From what I can see, the Symfony2 BrowserKit module modifies any headers added into the HTTP_XXX_XXX format, so the header being sent seems to be HTTP_AUTHORIZATION - when I output the received headers in my application, however, neither Authorization nor HTTP_AUTHORIZATION are present. If it helps, here is my Codeception test: public function

Securing REST endpoint using spring security

雨燕双飞 提交于 2019-12-05 02:52:14
I am trying to provide security to the REST endpoints. I am following instructions from this page . In my case I don't have view hence I haven't created controller to specify the views and haven't added viewResolver in my AppConfig.java After implementation it correctly shows the access denied error upon calling a secured REST endpoint. But even though I specify username/password in the request header I get the access denied error. I am testing in postman setting username/password in Basic Auth. What am I missing any idea? The example you have followed is implementing a form-based

OAuth2 “Invalid Grant” response from server

◇◆丶佛笑我妖孽 提交于 2019-12-05 01:45:01
I ask my client to hit at this URL with his authorized gmail account with which he has created the google api project. https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=http://www.XXXXXXXX.com/oauth2callback&client_id=XXXXXX.apps.googleusercontent.com&state=profile&approval_prompt=force and then ask him to provide me the code parameter from the redirected URL http://www.XXXXXXXX.com/oauth2callback?code=4/jUxc2MdX0xmF-b4_I6v2SLMQMuxO.cvQLVEpcJMUXOl05ti8ZT3ZvsT9ddwI Then i myself post this form