コード例 #1
0
ファイル: AccountController.cs プロジェクト: RocChing/Net.Qks
        public virtual async Task <ActionResult> SwitchToLinkedAccountSignIn(string tokenId)
        {
            var result = await _userLinkManager.GetSwitchedUserAndIdentity(tokenId);

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

            return(RedirectToAppHome());
        }
コード例 #2
0
        public async Task<SwitchedAccountAuthenticateResultModel> LinkedAccountAuthenticate(string switchAccountToken)
        {
            var result = await _userLinkManager.GetSwitchedUserAndIdentity(switchAccountToken);
            var accessToken = CreateAccessToken(CreateJwtClaims(result.Identity));

            return new SwitchedAccountAuthenticateResultModel
            {
                AccessToken = accessToken,
                EncryptedAccessToken = GetEncrpyedAccessToken(accessToken),
                ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds
            };
        }
コード例 #3
0
        public async Task <SwitchedAccountAuthenticateResultModel> LinkedAccountAuthenticate(string switchAccountToken)
        {
            var result = await _userLinkManager.GetSwitchedUserAndIdentity(switchAccountToken);

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

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

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