how to get access token after windows azure active directory authentication -


we have implemented active directory authentication using process given @ url http://msdn.microsoft.com/en-us/library/windowsazure/dn151790.aspx . here able authenticate user on https://login.microsoftonline.com/ , return web site not able access token after successful authentication. following code through able access user name, surname etc after successful authentication not access token. can provide me code through can access token after authentication.

 public class homecontroller : controller     {         public actionresult index()         {              claimsprincipal cp = claimsprincipal.current;             string fullname =                    string.format("{0} {1}", cp.findfirst(claimtypes.givenname).value,                    cp.findfirst(claimtypes.surname).value);             viewbag.message = string.format("dear {0}, welcome expense note app",                               fullname);                                            return view();          } } 

you can use code access security token used:

claimsprincipal cp = claimsprincipal.current; claimsidentity ci = cp.identity claimsidentity; bootstrapcontext bc = ci.bootstrapcontext bootstrapcontext; securitytoken securitytoken = bc.securitytoken; 

you need set savebootstrapcontext attribute in config file:

<system.identitymodel>     <identityconfiguration savebootstrapcontext="true">     ... </system.identitymodel> 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -