owin

How to run self-hosted(owin based) web api on IIS?

一笑奈何 提交于 2021-02-19 06:50:34
问题 I have developed self-hosted(owin based) web api using console application. In development phase I was running the console application and everything was okay. static void Main(string[] args) { string baseUri = "http://+:8080"; Console.WriteLine("Starting web Server..."); var server = WebApp.Start<Startup>(baseUri); Console.WriteLine("Server running at {0} - press Enter to quit. ", baseUri); Console.ReadLine(); server.Dispose(); } Now I need to deploy my self-hosted web api to run on IIS.So,

Adding claims to Azure AD authentication

你离开我真会死。 提交于 2021-02-11 14:06:38
问题 I am right now using Microsoft Authentication with Owin and Azure AD. I want to add a custom claim (not one of the optional ones you can choose in AAD), and be able to assign my own value to this claim, before login with Microsoft, so the claim gets associated with my Authentication login with Microsoft. This is because I want to be able to access this claim at a later stage in my application after login. Is this possible? 来源: https://stackoverflow.com/questions/62532800/adding-claims-to

SignalR 2, Autofac, OWIN WebAPI will not pass message from server to hub

天大地大妈咪最大 提交于 2021-02-11 13:10:12
问题 I have tried several variations over the past several weeks and so far all I can do is pass a message from the UI to the server and back. I am unable to pass a message from my controller or other method outside the hub to the UI. It seems like I am not getting an instance of the HubContext. I've created a basic demo app from scratch and uploaded here: https://github.com/cdecinkoKnight/SignalRDemo-help I have a basic hub (MessageHub): [HubName("messages")] public class MessageHub : Hub,

SignalR 2, Autofac, OWIN WebAPI will not pass message from server to hub

牧云@^-^@ 提交于 2021-02-11 13:10:05
问题 I have tried several variations over the past several weeks and so far all I can do is pass a message from the UI to the server and back. I am unable to pass a message from my controller or other method outside the hub to the UI. It seems like I am not getting an instance of the HubContext. I've created a basic demo app from scratch and uploaded here: https://github.com/cdecinkoKnight/SignalRDemo-help I have a basic hub (MessageHub): [HubName("messages")] public class MessageHub : Hub,

Swagger isn't working in OWIN Startup Web API C#

无人久伴 提交于 2021-02-11 12:53:28
问题 I've implemented Swagger in the OWIN startup.cs file in my Web API, but when I try to open Swagger UI page it says HTTP Error 404.0 - Not Found URL to check Swagger UI: https://localhost:5001/swagger Here is my implementation, please help me what I'm missing. Startup.cs public class Startup { public void Configuration(IAppBuilder app) { app.Map("/api", map => { ConfigureApiArea(map); }); } private void ConfigureApiArea(IAppBuilder map) { var config = CreateTypedConfiguration<BaseApiController

Retrieving Autofac container to resolve services

风格不统一 提交于 2021-02-10 06:40:16
问题 In a C# WindowForms application I start an OWIN WebApp that creates a singleton instance of my other class Erp: public partial class Engine : Form { const string url = "http://*:8080"; //49396 private IDisposable webApp; public Engine() { InitializeComponent(); StartServer(); } private void StartServer() { webApp = WebApp.Start<Startup>(url); Debug.WriteLine("Server started at " + url); } private void btnDoSomething(object sender, System.EventArgs e) { // needs to call a method in erp } }

OWIN SignOut doesn't remove cookie

夙愿已清 提交于 2021-02-07 11:16:30
问题 I am using the OWIN middleware in an external Authentication Server that my applications authenticate to using OAuth Authorisation Code Grant flow. I can redirect to the Authentication Server, authenticate against an external provider (Google) and redirect back to my client application with a logged in user and Application Cookie set just fine, however when I try to sign out the cookie remains after I call the AuthenticationManager.SignOut method. My cookie options in Startup.Auth.cs are: var

Add more values to the bearer token json

风流意气都作罢 提交于 2021-02-07 09:30:42
问题 I want to return the user name after they logged in successfully to display on the upper right corner on my web app. I want to send it with the json that bearer the token returns. To generate the token authentication I'm using ASP.NET web API and Owin middlehawe. { "access_token": "blah", "token_type": "bearer", "expires_in": 599 } I want the return to be like this { "access_token": "blah", "token_type": "bearer", "expires_in": 599, "displayusername":"Hi Mundo" } I have tried claims but those

Shorten access token returned by OWIN in ASP.NET WebAPI 2

此生再无相见时 提交于 2021-02-07 09:30:02
问题 We've developed a REST API using ASP.NET WebAPI 2 & secured it using ASP.NET Identity. The client required that their token be set to a long expiration time, as they store the access token in their database. During testing, they requested that we reduce the length of the token, as their database can only handle strings up to 250 characters. Our implementation is pretty "vanilla". Below are the options we're currently setting for the bearer token: OAuthOptions = new

Add more values to the bearer token json

这一生的挚爱 提交于 2021-02-07 09:29:41
问题 I want to return the user name after they logged in successfully to display on the upper right corner on my web app. I want to send it with the json that bearer the token returns. To generate the token authentication I'm using ASP.NET web API and Owin middlehawe. { "access_token": "blah", "token_type": "bearer", "expires_in": 599 } I want the return to be like this { "access_token": "blah", "token_type": "bearer", "expires_in": 599, "displayusername":"Hi Mundo" } I have tried claims but those