bearer-token

Generate bearer token using c#

怎甘沉沦 提交于 2020-03-23 03:59:19
问题 I have a web application. My requirement is that i need to generate oauth2 bearer token on every login. Currently we are using thinktecture to generate token, but this procedure is taking almost 7 seconds to generate token everytime. Is there any way i can generate token without using thinktecture ? 回答1: If you have created a new ASP.NET Web Application -> Web API with Individual User Accounts . Have a look at App_Start -> Startup.Auth.cs . It should contain something like this:

.net core 2.2 multiple bearer token authentication schemes

二次信任 提交于 2020-02-25 13:12:06
问题 I am currently trying to use 2 different bearer tokens in a .net core 2.2 app. I would like to use an Identity Server token and an Azure AD bearer token. According to Microsoft this is possible (https://docs.microsoft.com/en-us/aspnet/core/security/authorization/limitingidentitybyscheme?view=aspnetcore-2.2) but I am having no success getting it working. I have the Identity Server token as the "default" authentication followed by the AzureAD token as documented in the aforementioned link:

Using a bearer token for authentication(≠ authorization)

耗尽温柔 提交于 2020-01-14 07:04:26
问题 A request using the Authorization: bearer [token] can be used for authentication? or Should we use another method to authenticate a client and issue a token then use the token as a bearer token like OAuth2 does? Why popular web services(e.g. Github, AWS, Google..) uses other method(like AWS does: Authorization: AWS4-HMAC-SHA256 Credential=... ) to authenticate a client. The point of the question is: is there any valunerables or violation of standards in the following flow or not. I would like

MVC 5 Web API Login without Bearer Token

淺唱寂寞╮ 提交于 2020-01-07 02:24:27
问题 Long story short. I have a login form in the header on every single page, when I log in successfully it works fine but when the user is incorrect for example it redirects to the default login page (a view that was originally created with MVC project) with the model errors. I don't want to do that, I want to show errors next to the login form without redirecting. So I decided to implement a login via WEB API - i.e. it does $.ajax jQuery request to the Login API Controller, tries to log user in

IdentityServer 4 get timestamp while login/refresh token

拈花ヽ惹草 提交于 2020-01-06 08:11:03
问题 We are using identity server 4 to protect the api/resources. One of the requirements is to trace the user activity which means, the last time the user consumed the api (not logged in but consumed). As we have 30+ apis, we thought it would be easrier to intercept this validation process/event to register in the database the last activity date once the token gets validated against the identity server . My question here, does this validation really happens on identity server level each and every

Bearer token WEB API asp.net core without redirection

≡放荡痞女 提交于 2020-01-05 05:39:09
问题 I'm new to asp.net core. I'm trying to make a small web service using jwt authentication and OpenOauth from Google , Facebook, ... I've read this post : https://stormpath.com/blog/token-authentication-asp-net-core This post is about authenticating with jwt in ASP.Net core, but, I also want to verify whether the user is disabled or active in my system . My db has one table with 4 columns: Id, Name, Password, Status (0 - Disabled | 1 - Active). How can I archieve my goal ? Can anyone help me

How to save JWT Token in Vuex with Nuxt Auth Module?

不打扰是莪最后的温柔 提交于 2020-01-05 05:27:11
问题 I am currently trying to convert a VueJS page to NuxtJS with VueJS. Unfortunately I have some problems with authenticating the user and I can't find a solution in Google. I only use Nuxt for the client. The API is completely separate in express and works with the existing VueJS site. In Nuxt I send now with the Auth module a request with username and password to my express Server/Api. The Api receives the data, checks it, and finds the account in MongoDB. This works exactly as it should. Or

How to send bearer token to views in ASP NET MVC 5?

廉价感情. 提交于 2020-01-05 04:41:31
问题 I have a .NET MVC and WEB API project. I want to call the WEB API controllers from javascript but I didn't find a way to send the token to my views. I want to add the bearer token in Viewbag variable, using the below code: protected override void OnActionExecuting(ActionExecutingContext filterContext) { //GetBearerToken doesn't exists ViewBag.BearerToken = Request.GetOwinContext().GetBearerToken(); } In _Layout.cshtml , I added the folowing code to set Authorization header for all ajax

Retrieve bearer token in ASP.NET WebAPI

谁都会走 提交于 2020-01-02 06:20:18
问题 I have a Web API with authentication enabled (bearer token). This is called by a client application and I want to protect it from anonymous usage so I would like to create a single user and create a bearer token for it. I can create the token by calling the register and token methods, but I would like to do this from code. As far as I know, the bearer token is not stored in the database. Can it be retrieved somehow using the ASP.NET Identity API ? I would also like to create this user from

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