RefreshToken undefined after successful Authentication ServiceStack

房东的猫 提交于 2019-12-02 06:54:17

If you're overriding CredentialsAuthProvider with a Custom AuthProvider make sure you're also setting Authentication was performed with:

authService.Request.Items[Keywords.DidAuthenticate] = true;

Support for JWT RefreshTokens also requires a registered AuthRepository.

If you're using a Custom AuthProvider without an IAuthRepository I've just added support for implementing IUserSessionSource as an alternative source to populating Sessions in new JWT Tokens, which you can utilize by registering it in your IOC or having your Custom AuthProvider implement:

public interface IUserSessionSource
{
    IAuthSession GetUserSession(string userAuthId);
}

The implementation should only return a populated IAuthSession if they're allowed to sign-in, i.e. if their account is suspended it should throw an Exception like:

throw HttpError.Forbidden("User is suspended");

Support for IUserSessionSource is available from ServiceStack v5 that's now available on MyGet. Please review v5 changes before upgrading.

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