I am building a new application that will be using Angular 5 on the front end, and ASP.NET 4.5, along with Web API and Owin on the back.
I want to use Okta to validate the id_token recieved when a user is authenticated to secure my api’s. To do this I will use the [Authorize] attribute to validate if a request contains a valid token.
I am new to Okta as an identity provider, and I am use to configuring these settings in a Owin startup file, along with the Web API configuration.
How do I configure my applications Owin startup.cs file to accept JWT/id_token I receive from incoming requests from my API?
Here is my Startup.cs file
public class Startup
{
public void Configuration(IAppBuilder app)
{
// Configure Web API
WebApiConfig.Configure(app);
}
}
Here is my WebApiConfig.cs file
public static class WebApiConfig
{
public static void Configure(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
// Web API routes
config.MapHttpAttributeRoutes();
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
//config.MessageHandlers.Add(new PreflightRequestHandler());
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
app.UseWebApi(config);
}
}