authorization

Authorization roles WebAPI oauth owin

守給你的承諾、 提交于 2019-11-28 22:32:04
问题 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

Custom user authorization based with roles in asp.net mvc

淺唱寂寞╮ 提交于 2019-11-28 22:03:35
I have created a custom authentication and authorisation for my users.The problem I am facing is how to get mvc to check that role from inside my users table matches the [Authorize(Role)] on my controller so as to set httpauthorised to true.Below is my customauthorise class. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)] public class CustomAuthorizeAttribute : AuthorizeAttribute { public override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); if (!filterContext.HttpContext.User.Identity

Implement a Tomcat Realm with LDAP authentication and JDBC authorization

早过忘川 提交于 2019-11-28 21:41:40
I'm working in a legacy environment where an LDAP server is used only for authentication and contains no roles, and authorization is done against a database which contains the user-role mapping, but no passwords. My plan is to implement a new Tomcat Realm by extending JNDIRealm, and overriding the role methods to call an encapsulated JDBCRealm. My realm is declared in server.xml: <Realm className="com.example.LdapJdbcRealm" connectionURL="ldap://ldaphost:389" resourceName="LDAP Auth" userPattern="uid={0}, ou=Portal, dc=example, dc=com" dbConnectionURL="jdbc:oracle:thin:@oracledb:1521:dbname"

How to protect RESTful API

南笙酒味 提交于 2019-11-28 21:20:56
I have been looking for a way to protect my RESTful APIs. This appeared simple, but it seems to not be so simple. First off, I am writing an iOS app connecting to a Play Framework server. None of this has anything to do with Google, Facebook, Twitter, or LinkedIn (shocking I know). Oh, and my current plans do not require custom apps to use my APIs, its just my apps for the time being. Basic Authentication What appeared to be simple was a basic user/pass on a /auth method managing a cookie session. That may draw some groans as being too simple or weak but mostly it moved identity to a session

Authentication for a Symfony2 api (for mobile app use)

ⅰ亾dé卋堺 提交于 2019-11-28 21:14:36
问题 I've developed a REST api for my Symfony2 application. This api will be used by a mobile app. Much of the functionality is done in the context of the currently authenticated user, ie: $this->container->get('security.context')->getToken()->getUser() I'm hoping that the mobile app will be able to post to the login action just like a traditional web form. If the credentials check out then Symfony2 does it's thing and sets a cookie (does this even work in the context of a mobile app accessing an

How to configure user and password for neo4j cluster without REST API

岁酱吖の 提交于 2019-11-28 21:07:04
The version I use is neo4j-enterprise-2.2.0-M02 My question is : How can I configure a user (like add a new user, change the password ,etc) in backend or browser, instead of REST API? Can I do it via neo4j-shell? imagine that I am a DBA, it is not very convenient to do this by REST API. Any help will be greatly appreciated! You can use the browser instead of the API. Just go to http://localhost:7474 (or whatever IP to which the web console is bound) and you will be prompted to change the password. Once authenticated, use the command :server change-password to change the password again. It is

WCF username without certificate

百般思念 提交于 2019-11-28 20:56:44
I'm working on a project where I need the following. WCF service on the server side (.NET 3.5) WPF client for the client side (.NET 3.0) I have an existing application that I have to use the authentication and authorization from (on the server side). I also need to store some metadata about the user in the WCF Service's Thread Principal (a site object). I do this so that I can get at it in the WCF service if I absolutely have to; some business logic may require it. So my plan was to do the following... Create a custom ServiceAuthorizationManager for the server and in there I will log in the

How to get user name using Windows authentication in asp.net?

ぐ巨炮叔叔 提交于 2019-11-28 20:01:07
问题 I want to get user name using Windows authentication Actually I implemented "Sign in as different user",when click this button Windows security will appear there we can give credentials. In that time if I give some other credential it is taking current user name only. How to get that given credential user name from windows security? Host application in IIS then anonymous authentication has disabled and windows authentication was enabled. web.config: <system.web> <compilation debug="true"

Obtaining admin privileges to delete files using rm from a Cocoa app

强颜欢笑 提交于 2019-11-28 19:50:42
I am making a small app that deletes log files. I am using an NSTask instance which runs rm and srm (secure rm) to delete files. I want to be able to delete files in: /Library/Logs ~/Library/Logs The issue is that the user account does not have permissions to access some files in the system library folder, such as the Adobe logs subfolder and others. For example, only the "system" user (group?) has r/w permissions for the Adobe logs folder and its contents, and the current user doesn't even have an entry in the permissions shown in the Get Info window for the folder. What I want to be able to

JSF authentication and authorization

穿精又带淫゛_ 提交于 2019-11-28 19:19:50
问题 What is the best way to go about implementing authentication and authorization for a JSF web application? Preferrably I'd still want to use container-based security, as I need to call EJBs that require the principal. I realize form-based authentication is a major struggle with JSF, but can I perhaps use a PhaseListener or something similar together with programmatic logon to authenticate the user? Any other methods I should rather have a look at? 回答1: Try to check out the blog for using JAAS