internal static void SetBrokerResult(Intent data, int resultCode) { if (resultCode != BrokerResponseCode.ResponseReceived) { resultEx = new AuthenticationResultEx { Exception = new AdalException(data.GetStringExtra(BrokerConstants.ResponseErrorCode), data.GetStringExtra(BrokerConstants.ResponseErrorMessage)) }; } else { var tokenResponse = new TokenResponse { Authority = data.GetStringExtra(BrokerConstants.AccountAuthority), AccessToken = data.GetStringExtra(BrokerConstants.AccountAccessToken), IdTokenString = data.GetStringExtra(BrokerConstants.AccountIdToken), TokenType = "Bearer", ExpiresOn = data.GetLongExtra(BrokerConstants.AccountExpireDate, 0) }; resultEx = tokenResponse.GetResult(BrokerProxy.ConvertFromTimeT(tokenResponse.ExpiresOn), BrokerProxy.ConvertFromTimeT(tokenResponse.ExpiresOn)); } readyForResponse.Release(); }
private async Task <AuthenticationResultEx> SendHttpMessageAsync(IRequestParameters requestParameters) { client = new AdalHttpClient(this.Authenticator.TokenUri, this.CallState) { Client = { BodyParameters = requestParameters } }; TokenResponse tokenResponse = await client.GetResponseAsync <TokenResponse>().ConfigureAwait(false); return(tokenResponse.GetResult()); }
public void IdTokenParsingNoPasswordClaimsTest() { TokenResponse tr = CreateTokenResponse(); tr.IdTokenString = "eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiI5MDgzY2NiOC04YTQ2LTQzZTctODQzOS0xZDY5NmRmOTg0YWUiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8zMGJhYTY2Ni04ZGY4LTQ4ZTctOTdlNi03N2NmZDA5OTU5NjMvIiwiaWF0IjoxNDAwNTQxMzk1LCJuYmYiOjE0MDA1NDEzOTUsImV4cCI6MTQwMDU0NTU5NSwidmVyIjoiMS4wIiwidGlkIjoiMzBiYWE2NjYtOGRmOC00OGU3LTk3ZTYtNzdjZmQwOTk1OTYzIiwib2lkIjoiNGY4NTk5ODktYTJmZi00MTFlLTkwNDgtYzMyMjI0N2FjNjJjIiwidXBuIjoiYWRtaW5AYWFsdGVzdHMub25taWNyb3NvZnQuY29tIiwidW5pcXVlX25hbWUiOiJhZG1pbkBhYWx0ZXN0cy5vbm1pY3Jvc29mdC5jb20iLCJzdWIiOiJCczVxVG4xQ3YtNC10VXIxTGxBb3pOS1NRd0Fjbm4ydHcyQjlmelduNlpJIiwiZmFtaWx5X25hbWUiOiJBZG1pbiIsImdpdmVuX25hbWUiOiJBREFMVGVzdHMifQ."; AuthenticationResultEx result = tr.GetResult(); Assert.IsNull(result.Result.UserInfo.PasswordChangeUrl); Assert.IsNull(result.Result.UserInfo.PasswordExpiresOn); }