authorization

In a nutshell what's the difference from using OAuth2 request getAuthToken and getToken

ⅰ亾dé卋堺 提交于 2019-11-26 16:24:06
问题 When deling with access token OAuth 2.0 In a nutshell what's the difference from using: AccountManager.getAuthToken ("oauth2:https...userinfo.profile") , and using Google Plays: GoogleAuthUtil.getToken(mActivity, mEmail, mScope) As I understand it they both produce a challenge screen for the user, the Google Plays screen is user friendlier. The access token can have same scope right?! Both call have to be asynchronously. InvalidateToken looks like it has to be checked for in both calls, and

How to dynamically decide <intercept-url> access attribute value in Spring Security?

£可爱£侵袭症+ 提交于 2019-11-26 15:47:19
In Spring Security we use the intercept-url tag to define the access for URLs as below: <intercept-url pattern="/**" access="ROLE_ADMIN" /> <intercept-url pattern="/student" access="ROLE_STUDENT" /> This is hard coded in applicationContext-security.xml . I want to read the access values from a database table instead. I have defined my own UserDetailsService and I read the roles for the logged in user from the database. How do I assign these roles to the URL patterns during runtime? The FilterInvocationSecurityMetadataSourceParser class in Spring-security (try Ctrl/Cmd+Shift+T in STS with the

AngularJS clientside routing and token authentication with webapi

不问归期 提交于 2019-11-26 15:06:36
问题 I want to create an example for authentication and authorization in an SPA angularjs application using asp.net mvc webapi as the backend and client side routing (no cshtml). Below is just example of functions that can be used to set up the complete example. But I just can´t put it all togehter. Any help appreciated. Questions: What is best practise: Cookie or Token based? How do I create the bearer token in angular to authorize on each request? Validation on API functions? How do I preserve

How do I set up access control in SVN?

痴心易碎 提交于 2019-11-26 15:02:14
I have set up a repository using SVN and uploaded projects. There are multiple users working on these projects. But, not everyone requires access to all projects. I want to set up user permissions for each project. How can I achieve this? Stephen Bailey In your svn\repos\YourRepo\conf folder you will find two files, authz and passwd . These are the two you need to adjust. In the passwd file you need to add some usernames and passwords. I assume you have already done this since you have people using it: [users] User1=password1 User2=password2 Then you want to assign permissions accordingly with

Redirecting unauthorized controller in ASP.NET MVC

坚强是说给别人听的谎言 提交于 2019-11-26 14:57:36
I have a controller in ASP.NET MVC that I've restricted to the admin role: [Authorize(Roles = "Admin")] public class TestController : Controller { ... If a user who is not in the Admin role navigates to this controller they are greeted with a blank screen. What I would like to do is redirect them to View that says "you need to be in the Admin role to be able to access this resource." One way of doing this that I've thought of is to have a check in each action method on IsUserInRole() and if not in role then return this informational view. However, I'd have to put that in each Action which

How require authorization within whole ASP .NET MVC application

五迷三道 提交于 2019-11-26 14:19:52
问题 I create application where every action beside those which enable login should be out of limits for not logged user. Should I add [Authorize] annotation before every class' headline? Like here: namespace WebApplication2.Controllers { [Authorize] public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your

JMeter Basic Authentication

两盒软妹~` 提交于 2019-11-26 12:58:37
问题 I am trying to imply the basic authentication process for a web service using JMeter. But everytime it throws out an error 401:Unauthorized. I tried using the HTTP Header manager to add a header Authorization and value to it. Still it does not work. I have also tried using the HTTP Authorization manager. Still no luck. Can someone help. 回答1: I've found through debugging requests coming in from JMeter that the HTTP Authorization Manager module doesn't encode the username and password correctly

ASP.NET Web API : Correct way to return a 401/unauthorised response

江枫思渺然 提交于 2019-11-26 12:26:28
问题 I have an MVC webapi site that uses OAuth/token authentication to authenticate requests. All the relevant controllers have the right attributes, and authentication is working ok. The problem is that not all of the request can be authorised in the scope of an attribute - some authorisation checks have to be performed in code that is called by controller methods - what is the correct way to return a 401 unauthorised response in this case? I have tried throw new HttpException(401, \"Unauthorized

How to use basic authorization in PHP curl

与世无争的帅哥 提交于 2019-11-26 12:23:20
I am having problem with PHP curl request with basic authorization. Here is the command line curl: curl -H "Accept: application/product+xml" "https://{id}:{api_key}@api.domain.com/products?limit=1&offset=0" I have tried by setting curl header in following ways but it's not working Authorization: Basic id:api_key or Authorization: Basic {id}:{api_key} I get the response "authentication parameter in the request are missing or invalid" but I have used proper id and api_key which is working in command line curl (I tested) Please help me. Suhel Meman Try the following code : $username='ABC';

Authentication, Authorization and Session Management in Traditional Web Apps and APIs

拜拜、爱过 提交于 2019-11-26 11:48:31
问题 Correct me if I am wrong: In a traditional web application, the browser automatically appends session information into a request to the server, so the server can know who the request comes from. What exactly is appended actually? However, in a API based app, this information is not sent automatically, so when developing an API, I must check myself if the request comes from an authenticated user for example? How is this normally done? 回答1: HTTP Protocol is stateless by design, each request is