public IActionResult GetUserInfo(string accessToken)
        {
            var tokenDto = TokensRepository.Get(accessToken);

            if (tokenDto == null)
            {
                throw new Exception("Invalid token");
            }

            IBankApi bankApi;

            switch (tokenDto.BankId)
            {
            case BankEnum.Seb:
                bankApi = new SebApi();
                break;

            case BankEnum.MobileSign:
                bankApi = new IsignMobileApi();
                break;

            default:
                throw new Exception("Bank not supported");
            }

            var userInfo = bankApi.GetUserInfo(tokenDto);

            return(Ok(userInfo));
        }
Esempio n. 2
0
        public UserDto GetUserInfo(AccessTokenDto token)
        {
            var tokenDto = TokensRepository.Get(token.Token);

            return(tokenDto.User);
        }