authorization

ASP.Net MVC 4 Generic Principal Difficulties

痴心易碎 提交于 2019-12-02 19:15:59
I am developing an ASP.Net MVC 4 web application. Previously my MVC applications have been developed using MVC 3 and with this new MVC 4 application I have just copied/ reused my authentication and authorisation code from previous applications. When a user logs into my site I do the following Account Controller public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid) { User user = _userService.GetUser(model.Email.Trim()); //Create Pipe Delimited string to store UserID and Role(s) var userData = user.ApplicantID.ToString(); foreach (var role in user.UserRoles) {

Inbuilt authentication mechanism - API gateway

跟風遠走 提交于 2019-12-02 18:28:12
问题 API gateway has in-built functionality to perform authorization. But the examples provided by awslabs have lambda hooked to API gateway, where lambda is authorizing as per this code for a below API gateway: MyApi: Type: AWS::Serverless::Api Properties: StageName: Prod Auth: DefaultAuthorizer: MyLambdaRequestAuthorizer Authorizers: MyLambdaRequestAuthorizer: FunctionPayloadType: REQUEST FunctionArn: !GetAtt MyAuthFunction.Arn So, auth token provided by client is received by lambda and then

How to handle authentication and authorization with thrift?

喜夏-厌秋 提交于 2019-12-02 18:18:38
I'm developing a system which uses thrift. I'd like clients identity to be checked and operations to be ACLed. Does Thrift provide any support for those? Not directly. The only way to do this is to have an authentication method which creates a (temporary) key on the server, and then change all your methods so that the first argument is this key and they all additionally raise an not-authenticated error. For instance: exception NotAuthorisedException { 1: string errorMessage, } exception AuthTimeoutException { 1: string errorMessage, } service MyAuthService { string authenticate( 1:string user,

Some questions about OAuth and Android

霸气de小男生 提交于 2019-12-02 17:46:47
I started reading on OAuth this morning; need suggestions(links et al.) that will help answer the following questions: 1. How to implement 3 legged Authentication using OAuth on Android devices? Is there a library that assists in the aforementioned? 2. What does it mean when someone says: "Site/Service ABC supports OAuth"? Thanks! To address your first question, you should be able to use any Java OAuth library on an Android, here's a link to a tutorial that uses the Java OAuth project library to develop a consumer app on an Android: Android Client-side OAuth Specifically pay attention to the

Can you enable [Authorize] for controller but disable it for a single action?

天大地大妈咪最大 提交于 2019-12-02 17:39:01
I would like to use [Authorize] for every action in my admin controller except the Login action. [Authorize (Roles = "Administrator")] public class AdminController : Controller { // what can I place here to disable authorize? public ActionResult Login() { return View(); } } I don't think you can do this with the standard Authorize attribute, but you could derive your own attribute from AuthorizeAttribute that takes a list of actions to allow and allows access to just those actions. You can look at the source for the AuthorizeAttribute at www.codeplex.com for ideas on how to do this. If you did

MVC Role Authorization

时光毁灭记忆、已成空白 提交于 2019-12-02 17:18:46
I am trying to implement a role authorization mechanism which checks the roles of the current logged in user, if the user is in the right role, he/she is allowed, else display error view. The problem is that when the user tries to access the below method in the controller, he does get into the RoleAuthorizationAttribute class and gets verfied but then the method in the controller is not executed. Note : the user has the Client role Controller method [RoleAuthorization(Roles = "Client, Adminsitrator")] public ActionResult addToCart(int ProductID, string Quantity) { tempShoppingCart t = new

Get specific attributes from an ActiveRecord model

混江龙づ霸主 提交于 2019-12-02 17:16:52
Let's say that I have a User model with attributes :id, :first_name, :last_name, and :email . In my application, guest users shouldn't see User's email and last_name . I know how to select specific values if I want a list of users but I don't know how I can get specific attributes of a specific user like User.find_by(id: 5).select(:id, :first_name). One solution to that is to user User.find_by(id: 5).attributes.slice('id', 'first_name') but then I get a hash instead of an AR record. I could do User.select(:id, :first_name).find_by(id: 1) but the thing that I don't know which filters I should

Get ActionName, ControllerName and AreaName and pass it in ActionFilter Attribute

假如想象 提交于 2019-12-02 17:04:05
I use a custom AuthorizationFilter like the followings: public class ActionAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) { if(!httpContext.User.Identity.IsAuthenticated) return false; if(IsUserExcluded()) return false; else return IsRoleAuthorize(httpContext); } } I use this filter at the top of each action I have, and for check Is Authorized, need Action Name, Controller Name, And Area Name. So is there any way to get this names in AuthorizeCore() method like use System.Web.HttpContextBase ? if answer is No then how can

Stackoverflow's use of localstorage for Authorization seems unsafe. Is this correct else how do we strengthen it?

时光总嘲笑我的痴心妄想 提交于 2019-12-02 15:32:40
I have been working on a Authentication and authorization module similar to how stackexchange is in place. Now I am sure they use a certain model of oAuth or a token generation server that authorizes uses to their various sites. I tried a little experiment. Once I am logged into Stackoverflow, I delete all my cookies from the developer console. I leave my localstorage object intact which contains a key se:fkey xxxxxxxxxxxxxxxxxxxxxxxxx for stackoverflow domain. there is another key for stackauth domain GlobalLogin: xxxxxxxxxxxxxxxxxxxxxxx the se.fkey if I used for a session hijack, nothing

How can a JACC provider use the Principal-to-role mapping facilities of the server it's deployed on?

家住魔仙堡 提交于 2019-12-02 14:19:48
I am writing a JACC provider. Along the way, this means implementing a PolicyConfiguration . The PolicyConfiguration is responsible for accepting configuration information from the application server, such as which permissions accrue to which roles. This is so that a Policy later on can make authorization decisions when handed information about the current user and what he's trying to do. However, it is not part of the PolicyConfiguration 's (atrocious) contract to maintain a mapping between roles and their permissions, and Principals that are assigned to those roles. Typically--always, really