authorization

authorization with socket.io

半城伤御伤魂 提交于 2019-12-07 16:53:54
问题 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

How do I find original request path before redirect Express 4

可紊 提交于 2019-12-07 16:25: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

Google App Scripts curl authorization

可紊 提交于 2019-12-07 16:23:31
问题 Just trying to play with google app scripts. In anonymous mode things seem fine. Except that anyone can call my script simply like that snippet shows: curl "https://script.google.com/macros/s/.../exec?ip=\"$myIp\"" I used this manual for tips on how to authenticate through GoogleLogin. The problem is "401 Unauthorized" I received when sent auth token and "Me(owner)/Only myself" options were set on google side. (The token seems correct itself. If I omit password or mistype it, then I receive

deny custom role

牧云@^-^@ 提交于 2019-12-07 16:02:15
问题 how can i deny access to call method. something like this [HandleError] [Authorize(Roles = "role1, role2")] public class AdminController : Controller { [Deny(Roles = "role2")] public ActionResult ResultPage(string message) { ViewData["message"] = message; return View(); } } 回答1: You could simply do it the other way around and check for the presence of role1 instead of the absence of role2. Alternatively you could develop your own DenyAttribute that does what you want and verifies that the

Omniauth, Devise, Open ID, CanCan - Whats what and When do I use which solution for a Rails API app

拥有回忆 提交于 2019-12-07 14:29:56
问题 So Im developing a Rails app- primarily serves API which I want to lock down behjind a nice authorization system. Ive created Rails apps which render HTML and for that I used Devise and CanCan. This time I want to serve JSON to my clients. I basically have the following requirements: Need an authorization system thats robust A user should be able to log in with existing apps such as facebook, twitter, linked in and google There should be full stack authorization available Now this is my 1st

How to set HTTP Request Header “authentication” using HTTPClient?

对着背影说爱祢 提交于 2019-12-07 14:22:59
问题 I want to set the HTTP Request header "Authorization" when sending a POST request to a server. How do I do it in Java? Does HttpClient have any support for it? http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z9 The server requires me to set some specific value for the authorization field: of the form ID:signature which they will then use to authenticate the request. Thanks Ajay 回答1: Below is the example for setting request headers HttpPost post = new HttpPost("someurl"); post.addHeader

MVC Authorize attribute deny

不问归期 提交于 2019-12-07 11:45:19
问题 I'm using the Authorize() attribute to secure my controllers/actions and want to only display the Login action to unauthenticated users - or to put it another way, deny access to authenticated users. I haven't been able to find anything on the web dealing with either denying permission or allowing negative permissions (ie !LoggedIn) Can someone please point me in the right direction? MVC2, .Net 4 EDIT: To clairfy, I want something like this: Public Class PublicController Inherits

Active Directory Authentication with Local-Role-Based Authorization

两盒软妹~` 提交于 2019-12-07 11:17:44
问题 I'm developing an ASP.NET MVC application. I need to support multiple authentication mechanisms (this app is used by multiple customers, each with their own preferred authn provider). One auth provider will be Active Directory. The AD integration for authentication is straightforward and I have no problems with that. For authorization, roles will be stored in a local database (NOTE: we cannot use Active Directory groups for doing authorization - roles need to be local application roles

Should API gateway be responsible for authorisation?

一曲冷凌霜 提交于 2019-12-07 10:20:27
问题 Currently I have a monolith application with Java/Spring Boot the following endpoints: /login /logout /some-resource To access some-resource , the flow is following: The user makes a POST request to /login endpoint. If the credentials are correct, a JWT token is returned in header, otherwise a 401. The users sends the JWT token along with the request to /some-resource . If the token is valid, the resource is returned, otherwise 403. Now I want to split the monolith into 2 services:

Accessing authorization information in web.config

无人久伴 提交于 2019-12-07 09:24:52
问题 I'm writing a custom role provider and I need programmatic access the authorization information stored in the web.config. Certain section of the site are only accessible by certain roles. I would like to find out which roles can access a page and/or which page a certain role can access. I can't seem to figure this one out. 回答1: You can access any information stored such as ConnectionStrings,AppSettings and other defined values in web.config by WebConfigurationManager class in System.Web