public UserCredentials(string username, string api_access_key, AuthUrl authUrl) { this.username = username; this.api_access_key = api_access_key; this.authUrl = authUrl == utils.AuthUrl.UK ? new Uri(Constants.UK_AUTHURL) : new Uri(Constants.US_AUTHURL); }
public override string ToString() { var sb = new StringBuilder("AgeCheckRequestResult("); bool __first = true; if (AuthUrl != null && __isset.authUrl) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("AuthUrl: "); AuthUrl.ToString(sb); } if (SessionId != null && __isset.sessionId) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("SessionId: "); SessionId.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public override string ToString() { var sb = new StringBuilder("AgeCheckDocomoResult("); bool __first = true; if (AuthUrl != null && __isset.authUrl) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("AuthUrl: "); AuthUrl.ToString(sb); } if (__isset.userAgeType) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("UserAgeType: "); UserAgeType.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public void ValidateOptions() { ClientId.ThrowConfigurationExceptionIfNull($"{Position}:{ClientId}"); Secret.ThrowConfigurationExceptionIfNull($"{Position}:{Secret}"); AuthUrl.ThrowConfigurationExceptionIfNull($"{Position}:{AuthUrl}"); EmailUrl.ThrowConfigurationExceptionIfNull($"{Position}:{EmailUrl}"); SenderEmail.ThrowConfigurationExceptionIfNull($"{Position}:{SenderEmail}"); SenderName.ThrowConfigurationExceptionIfNull($"{Position}:{SenderName}"); }
/// <summary> /// Creates a token from the SSO response /// </summary> /// <param name="response"></param> /// <param name="authUrl"></param> /// <param name="scope"></param> /// <returns></returns> async Task <IOauthToken> GetToken(IAuthResponse response, AuthUrl authUrl, IScope scope) { var tokenRequest = GetTokenRequest(response.Code, authUrl.CodeVerifier); var tokenResponse = await client.SendAsync(tokenRequest); string json = await tokenResponse.Content.ReadAsStringAsync(); return(tokenFactory.FromJson(json, scope)); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.authUrl) { hashcode = (hashcode * 397) + AuthUrl.GetHashCode(); } if (__isset.sessionId) { hashcode = (hashcode * 397) + SessionId.GetHashCode(); } } return(hashcode); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.authUrl) { hashcode = (hashcode * 397) + AuthUrl.GetHashCode(); } if (__isset.userAgeType) { hashcode = (hashcode * 397) + UserAgeType.GetHashCode(); } } return(hashcode); }
public async Task <(IOauthToken token, string owner)> GetToken(IScope scope) { AuthUrl authUrl = GenerateAuthUrl(scope.ScopeString); IAuthResponse response = await responseManager.GetResponse(authUrl.Url, 10000); if (authUrl.State != response.State) { throw new Exception("Invalid auth response state."); } IOauthToken token = await GetToken(response, authUrl, scope); IJwtToken jwtToken = await validationManager.ValidateTokenAsync(token); return(token, jwtToken.Name); }
public ClientCredentials GetClientCredentials(string client_id, string client_secret) { ClientCredentials ret = null; try { ret = AuthUrl.PostUrlEncodedAsync(new { client_id, client_secret, scope = "payments", grant_type = "client_credentials" }).ReceiveJson <ClientCredentials>().Result; } catch (FlurlHttpException e) { Debug.WriteLine(e.Message); } catch (Exception e1) { Debug.WriteLine(e1.Message); } return(ret); }
public async Task <(IOauthToken token, string owner)> ListenForResponse(IScope scope, AuthUrl authUrl) { IAuthResponse response = await responseManager.AwaitResponse(20000); if (authUrl.State != response.State) { throw new Exception("Invalid auth response state."); } IOauthToken token = await GetToken(response, authUrl, scope); IJwtToken jwtToken = await validationManager.ValidateTokenAsync(token); return(token, jwtToken.Name); }