예제 #1
0
        public static void RegisterClient(IAuthenticationClient client, string displayName, IDictionary <string, object> extraData)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (String.IsNullOrEmpty(client.ProviderName))
            {
                throw new ArgumentException(WebResources.InvalidServiceProviderName, "client");
            }

            if (_authenticationClients.ContainsKey(client.ProviderName))
            {
                throw new ArgumentException(WebResources.ServiceProviderNameExists, "client");
            }

            var clientData = new AuthenticationClientData(client, displayName, extraData);

            _authenticationClients.Add(client.ProviderName, clientData);
        }
예제 #2
0
        /// <summary>
        /// Tries getting the OAuth client data of the specified provider name.
        /// </summary>
        /// <param name="providerName">Name of the provider.</param>
        /// <param name="clientData">The client data of the specified provider name.</param>
        /// <returns><c>true</c> if the client data is found for the specified provider name. Otherwise, <c>false</c></returns>
        public static bool TryGetOAuthClientData(string providerName, out AuthenticationClientData clientData)
        {
            if (providerName == null)
            {
                throw new ArgumentNullException("providerName");
            }

            return _authenticationClients.TryGetValue(providerName, out clientData);
        }
예제 #3
0
        public static void RegisterClient(IAuthenticationClient client, string displayName, IDictionary<string, object> extraData)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            if (String.IsNullOrEmpty(client.ProviderName))
            {
                throw new ArgumentException(WebResources.InvalidServiceProviderName, "client");
            }

            if (_authenticationClients.ContainsKey(client.ProviderName))
            {
                throw new ArgumentException(WebResources.ServiceProviderNameExists, "client");
            }

            var clientData = new AuthenticationClientData(client, displayName, extraData);
            _authenticationClients.Add(client.ProviderName, clientData);
        }
예제 #4
0
 public static void RegisterClient(IAuthenticationClient client,
     string displayName, IDictionary<string, object> extraData)
 {
     var clientData = new AuthenticationClientData(client, displayName, extraData);
     _authenticationClients.Add(client.ProviderName, clientData);
 }
예제 #5
0
 //
 // Summary:
 //     Indicates whether the provider gets an OAuth client data.
 //
 // Parameters:
 //   providerName:
 //     The provider name.
 //
 //   clientData:
 //     The client data.
 //
 // Returns:
 //     true if the provider gets an OAuth client data; otherwise, false.
 public static bool TryGetOAuthClientData(string providerName, out AuthenticationClientData clientData)
 {
     return OAuthWebSecurity.TryGetOAuthClientData(providerName, out clientData);
 }