How do you set katana-project to allow token requests in json format?

浪子不回头ぞ 提交于 2019-11-28 08:09:35
Aaron Fischer

Based on the current implementation of OAuthAuthorizationServerHandler you cannot.

private async Task InvokeTokenEndpointAsync()
{
     DateTimeOffset currentUtc = Options.SystemClock.UtcNow;
     // remove milliseconds in case they don't round-trip
     currentUtc = currentUtc.Subtract(TimeSpan.FromMilliseconds(currentUtc.Millisecond));

     IFormCollection form = await Request.ReadFormAsync();
     var clientContext = new OAuthValidateClientAuthenticationContext(
                Context,
                Options,
                form);

     await Options.Provider.ValidateClientAuthentication(clientContext);

     if (!clientContext.IsValidated)
     {
          _logger.WriteError("clientID is not valid.");
          if (!clientContext.HasError)
          {
               clientContext.SetError(Constants.Errors.InvalidClient);
          }
          await SendErrorAsJsonAsync(clientContext);
          return;
      }

      var tokenEndpointRequest = new TokenEndpointRequest(form);
}

So in order to attempt this you will need to provide your own implementation of OAuthAuthorizationServerMiddleware that overloads CreateHandler so you can provide your own implementation of AuthenticationHandler<OAuthAuthorizationServerOptions>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!