Reputation:
I am struggling from past one week to create sample app using openid connect and asp.net (vb.net).
Somehow I have converted one C# MVC
(with identityserver3 ) sample to vb.net but now it's login page not working as it's rendering at runtime.
now let's come to most scary question. Can we use openid connect using identityserver in vb.not ? in web forms ?
This is something same I want to achieve - MVC Authentication
I just wanted to achieve the following -
User login via oauth2
& openid
connect
after login use openid connect to access webapi that simply return some string.
Upvotes: 0
Views: 2403
Reputation: 76
So Identity Server is hosted in the middle ware,
So you'll have to turn that on and add some sort of start up file,
I don't know how owin works specifically with vb, but I'm sure it ties in decently.
I'm currently hitting Identity Server on a webforms project with C# code behind.
To get it to work I had to turn on the owin middleware
then modify the web.config:
I added this to the appSettings
<add key="Authority" value="whatever you set as you ids host in the other middleware" />
and ripped out all of the forms authentication stuff
also remove any authorization stuff you have in system.web
then I added this (this is C# code, but I bet the VB is similar) to my login page:
protected void Page_PreInit(object sender, EventArgs e)
{
HttpContext.Current.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties
{
RedirectUri = "your application uri"
},
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
Hope this helps
Upvotes: 1
Reputation: 2943
If I understood your question right, you want to have Open ID Connect solution for your asp.net application in VB. You can achieve this by hosting the Identity Server as a separate service along with your VB application. You don't need to convert Identity server to VB. It is a recommended practice to have Identity service as a seperate application and hence it can be in any technology of its own.
Hope this helps. Please let me know if you have any other questions.
Thank you, Soma.
Upvotes: 0