Update : I was able to improve this using the approach described below. Although this does not solve the problem described in my question, it eliminates the need for authentication in the authorization policy, since authentication is now handled by the custom AuthenticationManager, bypassing UserPasswordValidator alltogether.
I currently solved the problem by combining authentication and authorization in a user authorization policy. I would still rather find a way to connect to the regular UserNamePasswordValidator authentication scheme, since the authorization policy should be authorized by non-authentication.
internal class RESTAuthorizationPolicy : IAuthorizationPolicy { public RESTAuthorizationPolicy() { Id = Guid.NewGuid().ToString(); Issuer = ClaimSet.System; } public bool Evaluate(EvaluationContext evaluationContext, ref object state) { const String HttpRequestKey = "httpRequest"; const String UsernameHeaderKey = "x-ms-credentials-username"; const String PasswordHeaderKey = "x-ms-credentials-password"; const String IdentitiesKey = "Identities"; const String PrincipalKey = "Principal";
source share