authorization

How to authorize specific resources based on users who created those in REST, using annotations

我的未来我决定 提交于 2019-12-06 03:10:26
问题 I do not understand Java annotations with retention policy as RUNTIME that well. What I'm trying to do is create an annotation named @Authorize and use it on methods which needs user authorization in order to perform some action( the user is already authenticated at this point). eg. I have an order service with a getOrder() method. I want only the user who created this order to access it. ` public void getOrder(User user) { //current code does something like this if(order.getCreatedBy()

Database independent row level security solution

♀尐吖头ヾ 提交于 2019-12-06 02:32:26
does anybody knows about Java/C# database independent authorization library. This library should support read, write, delete, insert actions across company organizational structure. Something like this: - user can see all documents - user can enter new document assigned to his unit - user can change all documents assigned to his unit and all subordinate units. - user can delete documents that are assigned to him I should also be able to create custom actions (besides read, write,...) connect them to certain class and assign that "security token" to user (e.g. document.expire). If there aren't

Dynamic user based authorization in Pyramid

雨燕双飞 提交于 2019-12-06 01:37:33
问题 I'm following security guidelines found on Pyramid docs along with wiki tutorial Adding Authorization Now I need to add restrictions based un single user rather than groups. Let's say for example that, if any blog editor can have permission to review all comments, only post author can edit the post itself . For the first task I will have in my Root ACL like this: __acl__ = [ (Allow, Everyone, 'view'), (Allow, Authenticated, 'view_profile'), (Allow, 'groups:editor', 'edit_comment') ] but whay

How to change Spring Security roles by context?

余生长醉 提交于 2019-12-06 00:15:04
问题 I want to know if its possible to set roles based on a selected category. In our app there are categories which contain articles. Now we have a role hierarchy like this: ROLE_ADMIN > ROLE_EDITOR > ROLE_USER . The problem is that a user might have different roles based on the currently selected category: user1 - cat1 - ROLE_USER user1 - cat2 - ROLE_EDITOR The categories are not static. New ones can be added and older deleted. Is it possible to achieve this using Spring Security? 回答1: From your

When does an iphone application receive didChangeAuthorizationStatus: delegate call?

孤街醉人 提交于 2019-12-05 23:15:11
问题 I have a question about CLLocationManagerDelegate . The documentation says if the user changes the settings for your location services (in the iPhone's Settings.app) then your app is supposed to receive an didChangeAuthorizationStatus: message to the delegate. My question is, when would this happen? If the user changed the setting, it means they are in the settings app, and your app is either backgrounded or not running at all, so in the former case, when would your app's CLLocationManager

authorization with socket.io

两盒软妹~` 提交于 2019-12-05 22:51:21
I'm attempting to determine how best to authorize (in addition to authenticate) a user to perform a specific task using socket.io. In express, this is fairly straightforward. I first have a login/password form that queries the database to determine if the record exists, and if it does exist, then I attach the User to the req.session data. exports.session = function(req, res){ User.authenticate(req.body.username, req.body.password, function(err, user){ if (user){ req.session.user = user; res.redirect('/'); } else { console.log("authentication failed"); res.render('user/login'); } }); }; And

How to authorize/deny write access to a directory on Windows using Python?

醉酒当歌 提交于 2019-12-05 22:05:25
I would like to be able to authorize or deny write access to a specific directory on Windows XP and more. I tried the following, and they all don't work: os.chmod() : only a file read-only attribute can be specified, see Python's doc win32api.SetFileAttribute() FILE_ATTRIBUTE_READONLY: A file that is read-only. [...] This attribute is not honored on directories , see MSDN's SetFileAttribute It looks like the only alternative I have is to access and update the " Security info " of the directory, I've tried for several hours to get something done with this without much success (I'm really

Deadbolt - Play Framework - How to check a @RestrictedResource with parameters in a controller?

三世轮回 提交于 2019-12-05 21:41:43
With Deadbolt's module we can check the restrictedResource with a ressource name and parameters in the view. For example in my view, I have it, and it works well: #{deadbolt.restrictedResource resourceKeys:['Domain'] , resourceParameters:['domainid':domain.id]} <li><a href="@{Admin.showDomain(domain.id)}">${domain.title}</a></li> #{/deadbolt.restrictedResource} But in my controller, I just can check the ressource name but I don't find a way to check it in my RestrictedResourcesHandler passing the domainid with. I am looking for a solution to do something like that: @RestrictedResource(name = {

Protect entire website behind a login i.e. “Authorize” all Actions within all controllers

◇◆丶佛笑我妖孽 提交于 2019-12-05 21:31:55
title pretty much says it all. I have a website which will only run behind a login so I want to ensure that nothing can be accessed unless you're logged in. This includes ActionResults, JsonResults etc... Currently, I have [Authorize] all over my controllers which is quite tedious and not very DRY :) So can I protect the entire website with 1 magic line of code? (The login page will obviously need to be accessible) Also, please note that I will still need to further protect some of the Actions to only be used by certain Users/Roles If you have multiple controllers, then make a

How do I find original request path before redirect Express 4

萝らか妹 提交于 2019-12-05 20:39:24
Let's say I am trying to access the path http://localhost:3000/users#/WyCrYc28r/foo/1414585518343 . But the path /users needs to be accessed only by the authenticated users as following: app.get('/users', isLoggedIn, function (req, res) { req.session.user = req.user; res.cookie('uid', req.session.passport.user) .render('users', { title: 'The Foo Machine', user: req.user }); }); And following is the isLoggedIn middleware: function isLoggedIn(req, res, next) { if (req.isAuthenticated()) return next(); res.redirect('/login'); } And following is how the login is being handled: app.post('/login',