I'm trying to write a mobile application that will get data from a webapi rest based site.
The site should be secured via ACS (as there can be multiple identity providers).
My mobile app is currently querying the following url https://xx.accesscontrol.windows.net/v2/metadata/IdentityProviders.js?protocol=javascriptnotify&realm=http://xx.azurewebsites.net/&version=1.0 to get a list of IPs.
I then allow the user to choose an IP, and then using a web browser control I show them a login.
Once the user has logged in I capture the response and extract the token, but now I'm not really sure what I should be doing. The token looks like this:-
{"appliesTo":"http://****.azurewebsites.net/",
"context":null,
"created":1362069383,
"expires":1362072983,
"securityToken":"... a lot of text:-)",
"tokenType":"urn:ietf:params:oauth:token-type:jwt"}
So, I'm guessing I should take the securityToken part and add it has part of the Authorization header to the get request?
Question 1 is how should I attach the token - do I just attach the security token bit, or do I have to base 64 encode the lot and again attach it as an Authorization header?
Question 2 How do I configure the webapi to handle a JWT? After I have modified ACS to issue JWT tokens, and I installed the JWTSecurityTokenHandler I still get the following error (this is with passive authentication):
JWT10310: Unable to validate signature. validationParameters.SigningTokenResolver type: 'System.IdentityModel.Tokens.IssuerTokenResolver', was unable to resolve key to a token.
The SecurityKeyIdentifier is:
'SecurityKeyIdentifier
(
IsReadOnly = False,
Count = 1,
Clause[0] = X509ThumbprintKeyIdentifierClause(Hash = 0x2FEE3EE96B019D4BA0C046124B77C652EEF768E5)
)
'. validationParameters.SigningToken was null.
Thanks
Ross