authorization

How to Redirect Users to an ASP.NET page when not Authorized?

断了今生、忘了曾经 提交于 2019-11-30 03:08:20
I need my users are redirected to AuthError.aspx page ("You don't have the access to this page") in the case when they are authenticated but try to access the page that they cannot access (because of the role for exam). If I set up web.config so: <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> this is the system's wrong behaviour because an user is already authenticated and there is no need to redirect him or her to this page. But if I write here AuthError.aspx instead Login.aspx how could I redirect not-yet-authenticated user to the

How can I access the logged in user from outside of a controller?

瘦欲@ 提交于 2019-11-30 02:58:46
问题 I'm using SignalR to process clicks from the client on my MVC3 application. Every time a user clicks something, I need to verify the logged in user. If this were inside an MVC3 controller, I would go: if (User.Identity.IsAuthenticated) { string username = User.Identity.Name; //My code here. } However, this code execution is not inside a Controller class. Basically, how can I access the logged in users name from outside a controller? 回答1: Basically, how can I access the logged in users name

Rails 4 user roles and permissions

与世无争的帅哥 提交于 2019-11-30 01:53:42
I am writing a rails application for an organization. Every user may have 1 or more roles and can only access certain controller actions depending on those roles. For example, only admins can create, destroy and update certain fields of User s. Also, there are Team s which each have a team leader , and only the team leader can update certain information about the Team (like the member list, for example). However, Admins are the one who assign the team leader in the first place. The specific details of my scenario are not important, I merely hope I described the situation where there are many

Authorization roles WebAPI oauth owin

孤人 提交于 2019-11-30 01:43:41
I implemented a token authorization system on ASP.NET Web API with OWIN middleware. I successfully can authenticate with a REST client and obtain an authorization token to call the API. If I put the [Authorize] attribute on a GET action in my controller it also works correctly. If I don't have a valid token it denies the resource with a 401 message, but if I use [Authorize(Roles="admins")] with the roles parameter, it doesn't recognize the user's roles. I verified things in the database and checked that usersinroles is correctly filled. This is a code snippet: [Authorize(Roles = "admins")]

Should unauthorized actions in the UI be hidden, disabled, or result in an error? [closed]

纵饮孤独 提交于 2019-11-29 22:47:38
This is a perennial question for me that I've never really resolved so I'd like your input. If I have actions that I know a user will not be able to perform due to insufficient privileges or object state, should the UI elements for those actions be hidden from the user, visible but disabled, or visible and result in an error if attempted? What would be the rationale for your answer? If disabled, would you communicate the reason why and, if so, how? This is a web interface so I already know that I need to check the incoming post/get for permissions and handle errors there anyway. I'm primarily

Redirect Unauthorized Page Access in MVC to Custom View

一个人想着一个人 提交于 2019-11-29 22:35:25
I have an MVC website in which access is based on various Roles. Once a user logs into the system they can see navigation to the pages for which they are authorized. However, some users may still try to access pages using a direct URL. If they do, the system automatically redirects them to the Login Page. Instead of the Login Page I want to redirect them to another view (Unauthorized). Web.Config has the following entry: <customErrors mode="On"> <error statusCode="401" redirect="~/Home/Unauthorized" /> <error statusCode="404" redirect="~/Home/PageNotFound" /> </customErrors> <authentication

Granting access to IIS 7.5 ApplicationPoolIdentity [duplicate]

会有一股神秘感。 提交于 2019-11-29 22:11:13
This question already has an answer here: IIS7 Permissions Overview - ApplicationPoolIdentity 8 answers When I try to access my ASP.NET MVC application I get the error: Access to the path 'C:\inetpub\wwwroot\website\bin\test.Platform.Config.xml' is denied I run IIS 7.5 with an application pool that has the property: Identity: ApplicationPoolIdentity I imagine it is because the 'ApplicationPoolIdentity' cannot read the file I try to access. So my question is: Since the 'ApplicationPoolIdentity' is not a system user, which user or group do I need to grant further access in order to allow the

How to get permissions for using System.Diagnostics.Process.GetProcess(string)?

主宰稳场 提交于 2019-11-29 21:12:42
问题 I'm using Microsoft Visual Studio to make a simple remote task manager for experience purposes. I want to use Process.GetProcesses(string); but there is an access denied exception that won't allow me to get the remote computer process. In fact it is normal because we should authenticate using a user name and password, but how ? 回答1: You may try to use WMI for this purpose /// using System.Management; // don't forget! in VS you may have to add a new reference to this DLL ConnectionOptions op =

ASP MVC C#: Is it possible to pass dynamic values into an attribute?

我们两清 提交于 2019-11-29 20:49:02
问题 Okay I'm very new to C# and i'm trying to create a little website using ASP MVC2. I want to create my own authorization attribute. but i need to pass some values if this is possible. For example: [CustomAuthorize(GroupID = Method Parameter?] public ActionResult DoSomething(int GroupID) { return View(""); } I want to authorize the access to a page. but it depends on the value passed to the controller. So the authorization depends on the groupID. Is this possible to achieve this in any way?.

Support for Kerberos Authentication/Authorization on JMX Client/Server running on Java 6

别等时光非礼了梦想. 提交于 2019-11-29 20:31:37
问题 I have my JMX server which registers beans reading from local file and make them available to other JMX clients on demand. Server can be accessed either using "jconsole" or by Java app running under Tomcat container. What i want is to add authentication in order to prevent "unknown" identity accessing JMX Server. To achieve this i have added Kerberos authentication @ server using following JVM options -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=5555 -Dcom.sun