Пример #1
0
        public void CantGetEmailsWithEmptyAccessToken()
        {
            Exception exception =
                Assert.ThrowsAsync <NexaasIDException>(() => NexaasIdInstance.GetEmails(string.Empty))
                .Result;

            Assert.Equal(exception.Message, Messages.EmptyAccessToken);
        }
Пример #2
0
        public async Task <IActionResult> ProfileInfo([FromServices] NexaasID nexaasId)
        {
            var accessToken = User.FindFirstValue("NexaasIDAccessToken");

            if (string.IsNullOrWhiteSpace(accessToken))
            {
                return(await Task.FromResult <IActionResult>(Redirect("~/auth")));
            }

            var profileResponse = await nexaasId.GetProfile(accessToken);

            if (profileResponse.StatusCode != HttpStatusCode.OK)
            {
                return(View());
            }

            profileResponse.Data.Emails = (await nexaasId.GetEmails(accessToken))?.Data;

            profileResponse.Data.ProfessionalInfo = (await nexaasId.GetProfessionalInfo(accessToken))?.Data;

            profileResponse.Data.Contacts = (await nexaasId.GetContacts(accessToken))?.Data;

            return(View(profileResponse.Data));
        }