asp.net web api - Web api 2 - windows + client cert auth - is it possible? -


i have asp.net web api 2 site hosted in iis secured windows authentication. requirement has come in support client certificate authentication in addition windows, , i'm struggling find out: - if possible @ - if there working examples available

i thought might able add additional owin middleware or messagehandler or filter, can't see existing ones windows rather relying on iis. know thinktecture identitymodel can client cert, not sure if 2 can combined?

example of forms +win thought might similar here https://techblog.dorogin.com/mixed-windows-forms-authentication-for-ajax-single-page-application-e4aaaac0424a

right managed figure out. thankfully, if controller returns 401, iis automatically adds negotiate/ntlm headers, if user on windows browser, automatically authenticate usual. in mind, keep windows auth working, i:

  • updated site in both iis , vs allow anonymous , windows auth
  • added [authorizeattribute] global action filter (which causes 401 returned if user not authenticated time hit filter)

to client certificate auth working, used magnificent thinktecture.identitymodel library, allowed me add 1 line startup.cs file (we're using owin easy)

app.useclientcertificateauthentication(); 

see https://github.com/identitymodel/thinktecture.identitymodel/blob/master/samples/owin/authenticationtansformation/katanaauthentication/startup.cs example


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -