public static string GetAuthenticationUrl(string frob, string apiKey, string sharedSecret, AuthenticationPermissions permission) { Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add("api_key", apiKey); parameters.Add("perms", permission.ToString().ToLowerInvariant()); parameters.Add("frob", frob); string apiSig = GetApiSig(sharedSecret, parameters); parameters.Add("api_sig", apiSig); string[] keys = parameters.Keys.ToArray(); Array.Sort(keys); StringBuilder urlBuilder = new StringBuilder(AuthenticationServiceUrl); foreach (string key in keys) { if (urlBuilder.Length == AuthenticationServiceUrl.Length) urlBuilder.Append("?"); else urlBuilder.Append("&"); urlBuilder.Append(key); urlBuilder.Append("="); urlBuilder.Append(parameters[key]); } return urlBuilder.ToString(); }
protected Uri BuildAuthenticateUri(AuthenticationPermissions scope, ResponseType responseType) { var builder = new HttpUriBuilder(AuthenticationUrl); builder.AddQueryStringParameter("client_id", this.ClientId); builder.AddQueryStringParameter("response_type", responseType.ToString().ToLower()); builder.AddQueryStringParameter("scope", scope.GetParameterValue()); builder.AddQueryStringParameter("redirect_uri", RedirectUri); return builder.Build(); }
private static IEnumerable<AuthenticationPermissions> GetSubPermissions(AuthenticationPermissions permissions) { if (permissions.HasFlag(AuthenticationPermissions.WindowsLiveSignIn)) yield return AuthenticationPermissions.WindowsLiveSignIn; if (permissions.HasFlag(AuthenticationPermissions.WindowsLiveOfflineAccess)) yield return AuthenticationPermissions.WindowsLiveOfflineAccess; if (permissions.HasFlag(AuthenticationPermissions.OnedriveReadonly)) yield return AuthenticationPermissions.OnedriveReadonly; if (permissions.HasFlag(AuthenticationPermissions.OnedriveReadwrite)) yield return AuthenticationPermissions.OnedriveReadwrite; if (permissions.HasFlag(AuthenticationPermissions.OnedriveAppfolder)) yield return AuthenticationPermissions.OnedriveAppfolder; }
public override Uri BuildAuthenticateUri(AuthenticationPermissions scope) { return base.BuildAuthenticateUri(scope, ResponseType.Code); }
public string GetAuthenticationUrl(string frob, AuthenticationPermissions permission) { return RtmAuthentication.GetAuthenticationUrl(frob, Client.ApiKey, Client.SharedSecret, permission); }
public abstract Uri BuildAuthenticateUri(AuthenticationPermissions scope);
public override Uri BuildAuthenticateUri(AuthenticationPermissions scope) { return base.BuildAuthenticateUri(scope, ResponseType.Token); // return value contain 'access_token' 'authentication_token' 'token_type' 'expires_in' 'scope' 'user_id' }