Ejemplo n.º 1
0
        public virtual async Task <ActionResult> ImpersonateSignIn(string tokenId)
        {
            var result = await _impersonationManager.GetImpersonatedUserAndIdentity(tokenId);

            await _signInManager.SignInAsync(result.Identity, false);

            return(RedirectToAppHome());
        }
Ejemplo n.º 2
0
        public async Task<ImpersonatedAuthenticateResultModel> ImpersonatedAuthenticate(string impersonationToken)
        {
            var result = await _impersonationManager.GetImpersonatedUserAndIdentity(impersonationToken);
            var accessToken = CreateAccessToken(CreateJwtClaims(result.Identity));

            return new ImpersonatedAuthenticateResultModel
            {
                AccessToken = accessToken,
                EncryptedAccessToken = GetEncrpyedAccessToken(accessToken),
                ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds
            };
        }
Ejemplo n.º 3
0
        public async Task <ImpersonatedAuthenticateResultModel> ImpersonatedAuthenticate(string impersonationToken)
        {
            var result = await _impersonationManager.GetImpersonatedUserAndIdentity(impersonationToken);

            //var accessToken = CreateAccessToken(CreateJwtClaims(result.Identity));

            var identityServerToken = await _identityServerTokenGeneratorFacade.GetIdentityServerTokenForUserAsync(result.User);

            return(new ImpersonatedAuthenticateResultModel
            {
                AccessToken = identityServerToken.AccessToken,
                EncryptedAccessToken = GetEncrpyedAccessToken(identityServerToken.AccessToken),
                RefreshToken = identityServerToken.RefreshToken,
                ExpireInSeconds = identityServerToken.Token.Lifetime
            });
        }