When I began to read the ACS 2.0 document, I realized, ACS integrate with claim based authentication. So if I don't want to use claim in my application, how should I get data in SWT or JSON format?
Does anyone have an example of how to achieve this?
Most simple solution: switch ACS to use SWT token, configure your app to save bootstrap token and use them in your way web.config:
<system.identityModel>
<identityConfiguration saveBootstrapContext="true">
Application:
var claimIdentity = Thread.CurrentPrincipal.Identity as ClaimsIdentity;
if (claimIdentity == null)
{
return;
}
BootstrapContext bootstrapContext = claimIdentity.BootstrapContext as BootstrapContext;
SecurityToken token = null;
//you must configure SWT token handler in web.config or set up 'em manually like
SecurityTokenHandlerCollection handlers = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers;
//here is a bug in 4.5 cause a bootstrapContext.SecurityToken disappear sometimes.
//http://blogs.msdn.com/b/vbertocci/archive/2012/11/30/using-the-bootstrapcontext-property-in-net-4-5.aspx
if (bootstrapContext.SecurityToken != null)
{
token = bootstrapContext.SecurityToken;
}
else if (!string.IsNullOrEmpty(bootstrapContext.Token))
{
token = handlers.ReadToken(new XmlTextReader(new StringReader(bootstrapContext.Token)));
}