Home > OS >  Microsoft Owin | Adding WWW-Authenticate in case of unauthorized
Microsoft Owin | Adding WWW-Authenticate in case of unauthorized

Time:06-20

I am working on .net application. I can see that whenever https status code is 401, a www-authenticate header is appended with value Bearer.

I want change it so that it contain the authorization uri as follows

WWW-Authenticate: Bearer authorization_uri="example.com/login"

I have spent lots of time but I am not able to figure out how this token is auto appended in response when status code is 401.I can only see that after the call to onsending headers, the www-authenticate header is appended.

I tried to add new www-authenticate header, but I am getting following WWW-Authenticate: Bearer authorization_uri="example.com/login", Bearer

So I am not able to figure out how the value is auto appended.

Thanks

CodePudding user response:

I figured it out.WindowsAzureActiveDirectoryBearerAuthenticationOptions class is responsible for setting it. We can add options in it like realm.

  • Related