authorization

Authorization with RolesAllowedDynamicFeature and Jersey

冷暖自知 提交于 2020-01-02 02:38:10
问题 I'm trying to authenticate users with a JAX-RS filter what seems to work so far. This is the filter where I'm setting a new SecurityContext: @Provider public class AuthenticationFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext requestContext) throws IOException { requestContext.setSecurityContext(new SecurityContext() { @Override public Principal getUserPrincipal() { return new Principal() { @Override public String getName() { return "Joe";

Authorization in ASP.NET Core. Always 401 Unauthorized for [Authorize] attribute

有些话、适合烂在心里 提交于 2020-01-02 00:31:07
问题 For the first time I'm creating Authorization in ASP.NET Core. I used tutorial from here TUTORIAL The problem is when I sending request from postman: Authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6I... to my method in controller decorated with [Authorize] attribute. I receive 401 Unauthorized always... I saw comments bellow that tutorial and it seems that some people have similar issue also. I've no idea how I can solve this problem. 回答1: At the request of others here is the answer: The

ASP.NET MVC Roles Authorization

空扰寡人 提交于 2020-01-02 00:14:54
问题 I want to make the roles default for my controller class to "Administrators, Content Editors" [Authorize(Roles = "Administrators, Content Editor")] I've done this by adorning the controller with the attribute above. However, there is one action that I want to be available to all (namely "View"). How can I reset the Roles so that everyone (including completely unauthorized users) have access for this action. Note: I know I could adorn every single action other action with the authorize

OAuth access and refresh token control / management on user password change

╄→гoц情女王★ 提交于 2020-01-01 19:42:28
问题 We are in the process of developing a in house mobile application and web api. We are using asp.net web api 2 with asp.net Identy 2 OAuth. I have got the api up and running and giving me a bearer token. However I want to slightly modify the process flow to something like along the lines of this: App user logs in to api with username and password. App receives Refresh-token which is valid for 30 days. App then requests an access token providing the api with the refresh token. ( Here I want to

OAuth access and refresh token control / management on user password change

删除回忆录丶 提交于 2020-01-01 19:41:13
问题 We are in the process of developing a in house mobile application and web api. We are using asp.net web api 2 with asp.net Identy 2 OAuth. I have got the api up and running and giving me a bearer token. However I want to slightly modify the process flow to something like along the lines of this: App user logs in to api with username and password. App receives Refresh-token which is valid for 30 days. App then requests an access token providing the api with the refresh token. ( Here I want to

CouchDB: This database failed to load / No DB shards could be opened (logged in as admin)

廉价感情. 提交于 2020-01-01 19:15:43
问题 I am trying to regain access to my databases stored in CouchDB, but the error This database failed to load. gets shown instead of the databases (see attachments). I started seeing all of these errors at once It be some user rights misconfiguration (1. The error This database failed to load. is normal, when lacking privileges, 2. The actions to delete or replicate a DB are missing). However, I am logged as admin. Can you help me find the root cause of the error? Simple PUT and DELETE requests

CouchDB: This database failed to load / No DB shards could be opened (logged in as admin)

随声附和 提交于 2020-01-01 19:15:13
问题 I am trying to regain access to my databases stored in CouchDB, but the error This database failed to load. gets shown instead of the databases (see attachments). I started seeing all of these errors at once It be some user rights misconfiguration (1. The error This database failed to load. is normal, when lacking privileges, 2. The actions to delete or replicate a DB are missing). However, I am logged as admin. Can you help me find the root cause of the error? Simple PUT and DELETE requests

Mailgun + AngularJS + Auhtentication for http post request

南楼画角 提交于 2020-01-01 17:21:31
问题 I am trying to convert below sample code in angular request. https://documentation.mailgun.com/user_manual.html#sending-via-api curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from='Excited User <mailgun@YOUR_DOMAIN_NAME>' \ -F to=YOU@YOUR_DOMAIN_NAME \ -F to=bar@example.com \ -F subject='Hello' \ -F text='Testing some Mailgun awesomness!' I have tried below with Authorization headers which still comes back with Unauthorized error. I see request

JSP deny direct access to URL by non-logged in user

☆樱花仙子☆ 提交于 2020-01-01 17:11:36
问题 I have a login and a user info page which is displayed after login. How can I block user info page from direct access by user? How can I implement that with session? 回答1: At login time, put the found User object in the session. String username = request.getParameter("username"); String password = request.getParameter("password"); User user = userDAO.find(username, password); if (user != null) { request.getSession().setAttribute("user", user); response.sendRedirect("secured/userpage"); } else

JSP deny direct access to URL by non-logged in user

蓝咒 提交于 2020-01-01 17:11:22
问题 I have a login and a user info page which is displayed after login. How can I block user info page from direct access by user? How can I implement that with session? 回答1: At login time, put the found User object in the session. String username = request.getParameter("username"); String password = request.getParameter("password"); User user = userDAO.find(username, password); if (user != null) { request.getSession().setAttribute("user", user); response.sendRedirect("secured/userpage"); } else