authentication

ASP.NET Core 3.1.1 Jwt redirects instead of returning http status 401 after migration from ASP.NET Core 2.2

混江龙づ霸主 提交于 2021-01-04 14:54:59
问题 After migrating my website from .NET Core 2.2 to 3.1.1, my api endpoints suddenly started trying to redirect my api request to a default login page ( /Account/Login?ReturnUrl= , which I don't even have in any of my routes). My api is using a JWT bearer authentication scheme, with JWT Challenge Scheme, but still the redirect happened. services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultScheme = JwtBearerDefaults

GET image from authenticated route

穿精又带淫゛_ 提交于 2021-01-04 04:31:53
问题 I have a working image-upload front/back-end code working. Now I would like to be able to GET the image from server after it is uploaded. The problem is that the images must be behind an authenticated route, where user has to pass jwt token in header or body. When i try to fetch the image like this: fetch(imageURL, { method: 'GET', headers: { 'x-access-token': localStorage.getItem('token') } I just get a Form object as the response: <img alt="Your pic" src="[object FormData]"> Would there be

GET image from authenticated route

倖福魔咒の 提交于 2021-01-04 04:31:32
问题 I have a working image-upload front/back-end code working. Now I would like to be able to GET the image from server after it is uploaded. The problem is that the images must be behind an authenticated route, where user has to pass jwt token in header or body. When i try to fetch the image like this: fetch(imageURL, { method: 'GET', headers: { 'x-access-token': localStorage.getItem('token') } I just get a Form object as the response: <img alt="Your pic" src="[object FormData]"> Would there be

GET image from authenticated route

吃可爱长大的小学妹 提交于 2021-01-04 04:28:25
问题 I have a working image-upload front/back-end code working. Now I would like to be able to GET the image from server after it is uploaded. The problem is that the images must be behind an authenticated route, where user has to pass jwt token in header or body. When i try to fetch the image like this: fetch(imageURL, { method: 'GET', headers: { 'x-access-token': localStorage.getItem('token') } I just get a Form object as the response: <img alt="Your pic" src="[object FormData]"> Would there be

Quarkus: how to test secured API endpoints with swagger-ui

霸气de小男生 提交于 2021-01-03 07:08:02
问题 We have a Quarkus application with some secured endpoints. For development and easy testing without much effort, we would like to use Swagger UI as described at https://quarkus.io/guides/openapi-swaggerui. But this seems to only work for unprotected endpoints. Is there a way to also make request to protected endpoints in Swagger UI? 回答1: You need to add a security scheme to your specification: One way to do it is by using annotations: @OpenAPIDefinition(info = @Info(title = "My API", version

Quarkus: how to test secured API endpoints with swagger-ui

拜拜、爱过 提交于 2021-01-03 07:06:31
问题 We have a Quarkus application with some secured endpoints. For development and easy testing without much effort, we would like to use Swagger UI as described at https://quarkus.io/guides/openapi-swaggerui. But this seems to only work for unprotected endpoints. Is there a way to also make request to protected endpoints in Swagger UI? 回答1: You need to add a security scheme to your specification: One way to do it is by using annotations: @OpenAPIDefinition(info = @Info(title = "My API", version

Quarkus: how to test secured API endpoints with swagger-ui

老子叫甜甜 提交于 2021-01-03 07:05:51
问题 We have a Quarkus application with some secured endpoints. For development and easy testing without much effort, we would like to use Swagger UI as described at https://quarkus.io/guides/openapi-swaggerui. But this seems to only work for unprotected endpoints. Is there a way to also make request to protected endpoints in Swagger UI? 回答1: You need to add a security scheme to your specification: One way to do it is by using annotations: @OpenAPIDefinition(info = @Info(title = "My API", version

Quarkus: how to test secured API endpoints with swagger-ui

百般思念 提交于 2021-01-03 07:04:13
问题 We have a Quarkus application with some secured endpoints. For development and easy testing without much effort, we would like to use Swagger UI as described at https://quarkus.io/guides/openapi-swaggerui. But this seems to only work for unprotected endpoints. Is there a way to also make request to protected endpoints in Swagger UI? 回答1: You need to add a security scheme to your specification: One way to do it is by using annotations: @OpenAPIDefinition(info = @Info(title = "My API", version

Django-rest-auth (dj-rest-auth) custom user registration

拜拜、爱过 提交于 2021-01-02 03:29:19
问题 I'm using dj-rest-auth (https://dj-rest-auth.readthedocs.io/en/latest/) and trying to implement a custom registration form. When I'm trying to register a new user I have the base form. I've seen with the older version (https://django-rest-auth.readthedocs.io/en/latest/) that if you use password1 and password2, you don't have to retype all the code. serializers.py from rest_framework import serializers from dj_rest_auth.registration.serializers import RegisterSerializer class

Django-rest-auth (dj-rest-auth) custom user registration

断了今生、忘了曾经 提交于 2021-01-02 03:28:43
问题 I'm using dj-rest-auth (https://dj-rest-auth.readthedocs.io/en/latest/) and trying to implement a custom registration form. When I'm trying to register a new user I have the base form. I've seen with the older version (https://django-rest-auth.readthedocs.io/en/latest/) that if you use password1 and password2, you don't have to retype all the code. serializers.py from rest_framework import serializers from dj_rest_auth.registration.serializers import RegisterSerializer class