public async Task <object> Token([FromBody] Model.TokenRequest credentials) { var identity = await this.authService.ResolveUser(credentials.Username, credentials.password); if (identity == null) { throw new ServiceException(Constants.FailedToResolveUser); } this.SetAntiforgeryCookies(); return(await this.tokenService.IssueToken(identity, identity.Name)); }
public async Task <object> Token([FromBody] Model.TokenRequest credentials) { var identity = await this.authService.ResolveUser(credentials.Username, credentials.password); if (identity == null) { this.ThrowLocalizedServiceException(Constants.UnknownUser); } this.SetAntiforgeryCookies(); string cultureName = identity.Claims.FirstOrDefault(o => o.Type == CustomClaimTypes.CultureName).Value; string timeZoneId = identity.Claims.FirstOrDefault(o => o.Type == CustomClaimTypes.TimeZoneId).Value; this.cultureService.RefreshCookie(this.HttpContext, cultureName, timeZoneId); return(await this.tokenService.IssueToken(identity, identity.Name)); }