Here’s a few links I’ve found from the community that have integrated ServiceStack with IdentityServer JWT:
Feel free to ask @tobi on this thread for help in using his custom JWT AuthProvider.
These solutions use a custom AuthProvider to process Identity Server’s JWT directly although I prefer instead to let Identity Server handle the JWT Token and create the ClaimsPrincipal User and instead use the NetCoreIdentityAuthProvider
to provide an adapter to map it to an Authenticated UserSession.
See my StackOverflow answer on changes I’ve made to ServiceStack + IdentityServer Example on GitHub to get it to work with identity server which basically just removing all other Auth Providers and registering:
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[] {
new NetCoreIdentityAuthProvider(AppSettings),
}));
Which will work when the JWT has a “sub” otherwise you’d need to register what JWT property should be used instead, e.g:
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[] {
new NetCoreIdentityAuthProvider(AppSettings) {
MapClaimsToSession = {
["client_id"] = nameof(AuthUserSession.Id)
}
},
}));