Azure OpenId Token validation -


i new azure, tokens , on... have "digged" microsoft documentation , google , stackoverflow, still didn't full understanding.

so using openid owin library connect azure web app(vs2013 .net 4.5.1). , have next code it:

    public void configuration(iappbuilder app)     {         app.setdefaultsigninasauthenticationtype(        cookieauthenticationdefaults.authenticationtype);       app.usecookieauthentication(new cookieauthenticationoptions());         app.useopenidconnectauthentication(        new openidconnectauthenticationoptions                 {                     metadataaddress = string.format(aadinstance, tenant, policy),                     authenticationtype = policy,                                        clientid = clientid,                     redirecturi = redirecturi,                     postlogoutredirecturi = redirecturi,                     notifications = new openidconnectauthenticationnotifications                     {                         authenticationfailed = authenticationfailed                         ,securitytokenvalidated = onsecuritytokenvalidated                         ,authorizationcodereceived = onauthorizationcodereceived                         ,securitytokenreceived = onsecuritytokenreceived                     },                     scope = "openid profile",                     responsetype = "id_token"                                };         );     }   private task onsecuritytokenvalidated(securitytokenvalidatednotification<openidconnectmessage, openidconnectauthenticationoptions> notification)         {             var identity = notification.authenticationticket.identity;             var claims = notification.owincontext.authentication.user.claims;              claimsprincipal.current.addidentity(identity);              return task.fromresult(0);         } 

and working, in microsoft documentation found next instruction "currently, id tokens signed not encrypted. when app receives id token, must validate signature prove token's authenticity , validate few claims in token prove validity. claims validated app vary depending on scenario requirements, app must perform common claim validations in every scenario."

but there securitytokenvalidated-callback , have authenticationticket. still need somehow validate token/ticked or handled automatically (i been tough in army nothing happening automatically, still)?

the library using handles validation you.

it check signature should based on keys provided azure ad.

so don't need manual checks, other app's specific checks. example, app might allow members of group access app. need check if case.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -