Esempio n. 1
0
        public async Task <IActionResult> RegisterParent([FromBody] RegisterUserDTO user)
        {
            var result = await _accSrv.Register(user);

            if (result.Success)
            {
                var createdUser = result.Data.FirstOrDefault();
                var id          = (createdUser as AppUser)?.Id;
                var claims      = ClaimsHelper.GetClaims(new List <string>(), user.UserName, id);
                var jwt         = await this._identityServer.IssueJwtAsync(IdentityServerSettings.AccessTokenLifetime, claims);

                result.Data = new [] { new { access_token = jwt } };
                return(Ok(result));
            }

            return(BadRequest(result));
        }