Esempio n. 1
0
        /// <summary>
        /// Registers a supported OAuth client with the specified consumer key and consumer secret.
        /// </summary>
        /// <param name="client">One of the supported OAuth clients.</param>
        /// <param name="consumerKey">The consumer key.</param>
        /// <param name="consumerSecret">The consumer secret.</param>
        public static void RegisterOAuthClient(BuiltInOAuthClient client, string consumerKey, string consumerSecret)
        {
            IAuthenticationClient authenticationClient;

            switch (client)
            {
            case BuiltInOAuthClient.LinkedIn:
                authenticationClient = new LinkedInClient(consumerKey, consumerSecret);
                break;

            case BuiltInOAuthClient.Twitter:
                authenticationClient = new TwitterClient(consumerKey, consumerSecret);
                break;

            case BuiltInOAuthClient.Facebook:
                authenticationClient = new FacebookClient(consumerKey, consumerSecret);
                break;

            case BuiltInOAuthClient.WindowsLive:
                authenticationClient = new WindowsLiveClient(consumerKey, consumerSecret);
                break;

            default:
                throw new ArgumentOutOfRangeException("client");
            }
            RegisterClient(authenticationClient);
        }
Esempio n. 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            loginButton.Click += loginButton_Click;

            OAuthClient = new LinkedInClient(PortalId, Mode);
        }
Esempio n. 3
0
        /// <summary>
        /// Registers the LinkedIn client.
        /// </summary>
        /// <param name="consumerKey">The consumer key.</param>
        /// <param name="consumerSecret">The consumer secret.</param>
        /// <param name="displayName">The display name.</param>
        /// <param name="extraData">The data bag used to store extra data about this client</param>
        public static void RegisterLinkedInClient(
            string consumerKey,
            string consumerSecret,
            string displayName,
            IDictionary <string, object> extraData
            )
        {
            var linkedInClient = new LinkedInClient(consumerKey, consumerSecret);

            RegisterClient(linkedInClient, displayName, extraData);
        }
Esempio n. 4
0
        protected void InitializeClient()
        {
            if ((!String.IsNullOrEmpty(consumerKey)) && (!String.IsNullOrEmpty(consumerSecret)))
            {
                linkedInClient = new LinkedInClient(consumerKey, consumerSecret);

                if (haveAccessToken)
                {
                    linkedInClient.AccessToken = accessToken;
                }
            }
        }
Esempio n. 5
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            loginButton.Click    += loginButton_Click;
            registerButton.Click += loginButton_Click;

            OAuthClient = new LinkedInClient(PortalId, Mode);

            loginItem.Visible    = (Mode == AuthMode.Login);
            registerItem.Visible = (Mode == AuthMode.Register);
        }
 /// <summary>
 /// Initializes a new instance of the login form with a specified OAuth client.
 /// </summary>
 /// <param name="client">Instance of the OAuth client.</param>
 /// <param name="autoLogout">Disables saving and restoring authorization cookies in WebBrowser. Default: false.</param>
 /// <param name="loadUserInfo">Indicates the need to make a request for recive the user profile or not. Default: false.</param>
 public LinkedInLogin(LinkedInClient client, bool autoLogout = false, bool loadUserInfo = false) : base(client, autoLogout, loadUserInfo, ResponseType.Code) // NOTE: supported only "code"
 {
     this.Icon   = Properties.Resources.linkedin;
     this.Width  = 642;
     this.Height = 630;
 }
Esempio n. 7
0
 /// <summary>
 /// Constractor
 /// </summary>
 public LinkedinUtility()
 {
     linkedIn = new LinkedInClient(WebConfigurationManagement.LinkedinAppID, WebConfigurationManagement.LinkedinAppSecretKey);
 }
Esempio n. 8
0
 public void IsPublic()
 {
     var client = new LinkedInClient(null, null, null);
     client.ShouldNotBeNull();
 }