authorization

MVC 3 AuthorizeAttribute Redirect with Custom Message

房东的猫 提交于 2019-12-18 03:12:36
问题 How can I create a custom AuthorizeAttribute that specifies a message in the form of a string parameter and then passes that along to the login page? For example, ideally it would be cool to do this: [Authorize(Message = "Access to the blah blah function requires login. Please login or create an account")] public ActionResult SomeAction() { return View(); } Then, in the Login action, I could do something like this: public ActionResult Login(string message = "") { ViewData.Message = message;

TYPO3: 404 for restricted access page instead of login form

前提是你 提交于 2019-12-18 02:48:43
问题 I have a link pointing to restricted page. When I access the link directly in logout status, its redirect to 404. Actually it should redirect to login form. I tried: config { typolinkLinkAccessRestrictedPages=PAGE_ID typolinkLinkAccessRestrictedPages_addParams = &return_url=###RETURN_URL###&pageId=###PAGE_ID### } Not working. Also I tried the login status redirect plugin, no use. Anyone know how to do this? I am using TYPO3 version 4.4.8. 回答1: As this is still unanswered, does this help? #

How to securely authorize a user via Facebook's Javascript SDK

醉酒当歌 提交于 2019-12-17 23:44:11
问题 I want to let users log in on my website using their Facebook ID without reloading the page. This is why I use Facebook Javascript SDK. This scheme describes the authorization flow with this SDK: At the end of the process I know that the user is logged in and I know their Facebook ID. I can then register them in my database via this ID, and let them use it to log in afterwards. However, this seems terribly insecure. In order to let my server-side script know the user's ID, I have to send it

MVC 3 dynamic authorization of multiple roles and users

本小妞迷上赌 提交于 2019-12-17 23:20:06
问题 I recently starded developing for MVC 3 but have experience in both C# and ASP.NET since earlier. So i'll start with what i'm trying to accomplish. I've developed a small site for hosting articles. I've implemented SQLServer based membership managament to the site. Now i want to create a credentials system that restricts and allows the right users to create, delete and update articles. There is one simple solution to this and that is to do it like this: [Authorize(Roles="Admin")] public

Authorizing command line tool to consume Google APIs (through OAuth2.0 or anything else)

筅森魡賤 提交于 2019-12-17 22:34:09
问题 I think I understand how OAuth 2.0 works in the context of a mobile app or website - neither is my case. I have a C++ command line application that I want to give access to one of the Google Services (Google Fusion Tables) but I think this question applies to any of the Google Services, or heck, perhaps also any command line app that has to deal with OAuth2. I have the username. I have the password (the user typed it). I need to get a token so I can make the calls through Curl. What is the

How to get http headers in flask?

最后都变了- 提交于 2019-12-17 22:33:10
问题 I am newbie to python and using Python Flask and generating REST API service. I want to check authorization header which is sent the client. But I can't find way to get HTTP header in flask. Any help for getting HTTP header authorization is appreciated. 回答1: from flask import request request.headers.get('your-header-name') request.headers behaves like a dictionary, so you can also get your header like you would with any dictionary: request.headers['your-header-name'] 回答2: just note, The

ASP.NET MVC - Dynamic Authorization

点点圈 提交于 2019-12-17 22:26:17
问题 I am building a simple CMS in which roles are set dynamically in the admin panel. The existing way of authorizing a controller method, adding [Authorize(Roles="admin")] for example, is therefore no longer sufficient. The role-action relationship must be stored in the database, so that end users can easily give/take permissions to/from others in the admin panel. How can I implement this? 回答1: If you want to take control of the authorization process, you should subclass AuthorizeAttribute and

C# WinForms User/Permission management

烂漫一生 提交于 2019-12-17 22:21:49
问题 Can anyone provide me an example WinForms application that implements the concept of User authentication and authorization one the basis of Roles or Groups? The application should allow access of users to the main-menu on the basis of their roles. 回答1: If you are building the menu from a database table, you can security trim it by joining it to another table or view that excludes records on the basis of the permissions set. The diagram below illustrates the basics of setting up role

ASP.Net Core 2.0 mixed authentication of JWT and Windows Authentication doesn't accept credentials

好久不见. 提交于 2019-12-17 22:18:16
问题 I've API created in asp.net core 2.0 where I am using mixed mode authentication. For some controllers JWT and for some using windows authentication. I've no problem with the controllers which authorize with JWT. But for the controllers where I want to use windows authentication I am indefinitely prompted with user name and password dialog of chrome. Here my sample controller code where I want to use Windows Authentication instead of JWT. [Route("api/[controller]")] [Authorize

Best way to create a TOKEN system to authenticate web service calls?

≡放荡痞女 提交于 2019-12-17 22:07:07
问题 I'd like to create a web service architecture that can be called by various platforms such as mobile devices, winforms applications, iphone, blackberry, you name it. So going with something like WCF and wsHttp binding probably kills this and I would need to downgrade to a basicHttp binding for compatibility. With that said, I need a system to generate a token on initial login (authentication) and then use this token for all subsequent calls, I guess, to validate the authentication and allow