Hi all,
I would like to get the user roles returned to an Angular 4 client using the ServiceStack Typescript client during authentication and can’t seem to find / put the roles in the right place to be able to see them… sure I must be missing something simple.
Using a CustomAuthSession as below:
public class CustomAuthSession : AuthUserSession
{
public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
{
if (!session.Roles.Any())
{
throw new HttpError(HttpStatusCode.Forbidden, "User must have a role");
}
base.OnAuthenticated(authService, session, tokens, authInfo);
authService.SaveSession(session);
}
}
I’d like to be able to get the roles on the AuthenticationResponse:
login() {
this.authenticationService.login(username, password).then( authResponse => { authResponse.Roles??? });
};
Any help appreciated,
Thanks.