Just upgraded to 6.0.2, and after regenerating some dtos, my service client dtos lost the GetAccessToken endpoint.
I read here about the ForceInclude option. That worked for getting it back into Metadata, but it’s now missing from OpenApi routes, and so I fail to pass validation, as seen here (https://apitools.dev/swagger-parser/online/)
How do we include it into the openapi end-point as well?
GetAccessToken is an explicitly excluded DTO that’s already exists in ServiceStack’s client libraries, e.g. C# ServiceStack.Client.dll, @servicestack/client js/typescript, etc.
What validation is this where it’s expected to exist?
This is taking my /openapi route and submitting it to a swagger validator, as Azure Api Management won’t proceed if the /openapi result does not pass validation.
The test for the fix would be to have the /openapi route pass validation still providing the GetAccessToken endpoint.
There isn’t, you’d basically just try to replicate the JSON output by adding the C# classes which map 1:1 to the serialized json. During debug you can inspect the populated DTO to see how other APIs are populated.
So that seemed to work running against a validator
I haven’t check Azure Api Management yet, because I now get a new issue which I assume has more to do with going from 6.0.2 => 6.0.3.
System.NotSupportedException: UserAuthRepositoryAsyncWrapper does not implement IManageApiKeys
at ServiceStack.ApiKeyAuthProviderExtensions.AssertManageApiKeysAsync(ServiceStackHost appHost, IRequest req) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Auth/ApiKeyAuthProvider.cs:line 548
at ServiceStack.Auth.ApiKeyAuthProvider.Register(IAppHost appHost, AuthFeature feature) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Auth/ApiKeyAuthProvider.cs:line 369
and
System.NotSupportedException: UserAuthRepositoryAsyncWrapper does not implement IManageApiKeys
at ServiceStack.ApiKeyAuthProviderExtensions.AssertManageApiKeysAsync(ServiceStackHost appHost, IRequest req) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Auth/ApiKeyAuthProvider.cs:line 548
at ServiceStack.Auth.ApiKeyAuthProvider.GetApiKeyAsync(IRequest req, String apiKey) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Auth/ApiKeyAuthProvider.cs:line 290
at ServiceStack.Auth.ApiKeyAuthProvider.PreAuthenticateAsync(IRequest req, IResponse res) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Auth/ApiKeyAuthProvider.cs:line 271
at ServiceStack.AuthenticateAttribute.PreAuthenticateAsync(IRequest req, IEnumerable`1 authProviders) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/AuthenticateAttribute.cs:line 207
at ServiceStack.AuthenticateAttribute.ExecuteAsync(IRequest req, IResponse res, Object requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/AuthenticateAttribute.cs:line 76
at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingleAsync(IRequest req, IResponse res, Object requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/ServiceStackHost.Runtime.cs:line 180
at ServiceStack.ServiceStackHost.ApplyRequestFiltersAsync(IRequest req, IResponse res, Object requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/ServiceStackHost.Runtime.cs:line 144
at ServiceStack.Host.Handlers.GenericHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/Handlers/GenericHandler.cs:line 56
The issue is because it doesn’t implement IUserAuthRepositoryAsync or IManageApiKeysAsync (like ServiceStack’s built-in Auth Repos), I’ve added a change to try handle this, will let you know when it’s on MyGet.
Ok, that makes sense. Your fix will be the same as if I were to flush out and implement the two async versions? or in the end I’m still losing a little because it’s still resolving to my sync versions which are not fully async?
As it doesn’t have an Async impl it uses a less efficient sync wrapper, but your Auth Provider would have always been synchronous either way.
To improve performance you can add an IUserAuthRepositoryAsync and IManageApiKeysAsync implementation to your Custom Auth Provider, since it looks like it was originally based on our it should be fairly easy to copy the necessary functionality from MongoDbAuthRepositoryAsync.cs
C:\Dev>dotnet nuget locals all -clear
Specify --help for a list of available options and commands.
error: Unrecognized option ‘-clear’
Usage: dotnet nuget locals [arguments] [options]
Arguments:
Cache Location(s) Specifies the cache location(s) to list or clear.
<all | http-cache | global-packages | temp>
Options:
-h|–help Show help information
–force-english-output Forces the application to run using an invariant, English-based culture.
-c|–clear Clear the selected local resources or cache location(s).
-l|–list List the selected local resources or cache location(s).