That's the only idea I have so far.
So I had everything working just fine, locally, with resource server and auth server on the same box.
I deployed the auth server and resource server code to a deployment box (the same box).
Now I get errors saying that "Message signature was incorrect". From the samples, the method erroring is
VerifyOAuth2()
return resourceServer.GetPrincipal(httpDetails, requestUri, requiredScopes);
I changed my keys to be:
--Auth Server--
private static readonly RSAParameters ResourceServerEncryptionPublicKey = GetSigningKey("OAuthResourceServerEncryptionKey", false);
private static RSAParameters CreateAuthorizationServerSigningKey()
{
return GetSigningKey("OAuthAuthorizationServerSigningKey", true);
}
private static RSAParameters GetSigningKey(string containerName, bool includePrivate)
{
// This is how you could generate your own public/private key pair.
// As we generate a new random key, we need to set the UseMachineKeyStore flag so that this doesn't
// crash on IIS. For more information:
var cspParameters = new CspParameters();
cspParameters.KeyContainerName = containerName;
cspParameters.Flags = CspProviderFlags.UseArchivableKey | CspProviderFlags.UseMachineKeyStore;
var keyPair = new RSACryptoServiceProvider(cspParameters);
// After exporting the private/public key information, read the information out and store it somewhere
var key = keyPair.ExportParameters(includePrivate);
// Ultimately the private key information must be what is returned through the AccessTokenSigningPrivateKey property.
return key;
}
--Resource server--
public static readonly RSAParameters AuthorizationServerSigningPublicKey = GetSigningKey("OAuthAuthorizationServerSigningKey", false);
internal static readonly RSAParameters ResourceServerEncryptionPrivateKey =
GetSigningKey("OAuthResourceServerEncryptionKey", true);
Method GetSigningKey is the same in both instances.
I output the following to a file on the resource server, and everything matches the auth server (its the same server)
Inside the VerifyOAuth2 method:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
signxml = signing.ToXmlString(true);
encryptxml = encrypting.ToXmlString(true);
I ran the commands to give access to the windows identity to those two rsa key containers.
ie:
aspnet_regiis -pa "OAuthResourceServerEncryptionKey" "bradl"
In my web.config on the resource server I put <identity impersonate="false"> just for safety
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment> so the WCF example can run under IIS
Anyone have ideas?
--
You received this message because you are subscribed to the Google Groups "DotNetOpenAuth" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dotnetopenid/-/8lyfxuGIHpEJ.
To post to this group, send email to dotnet...@googlegroups.com.
To unsubscribe from this group, send email to dotnetopenid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dotnetopenid?hl=en.