Esempio n. 1
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166
            Dictionary <string, object> microsoftSocialData = new Dictionary <string, object>();

            microsoftSocialData.Add("Icon", "/images/icons/social/microsoft.png");
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: ConfigurationManager.AppSettings["Auth-MicrosoftAuthClientId"],
                clientSecret: ConfigurationManager.AppSettings["Auth-MicrosoftAuthClientSecret"],
                displayName: "Windows Live",
                extraData: microsoftSocialData);

            Dictionary <string, object> googleSocialData = new Dictionary <string, object>();

            googleSocialData.Add("Icon", "/images/icons/social/google.png");
            OAuthWebSecurity.RegisterGoogleClient("Google", googleSocialData);

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");
        }
Esempio n. 2
0
        public static void RegisterProviders()
        {
            var oauthConfig = OAuthConfig.Current;

            if (oauthConfig.MicrosoftEnabled)
            {
                OAuthWebSecurity.RegisterMicrosoftClient(oauthConfig.MicrosoftClientId, oauthConfig.MicrosoftClientSecret, Views.Literal_OAuth_Microsoft);
            }

            if (oauthConfig.LinkedInEnabled)
            {
                OAuthWebSecurity.RegisterLinkedInClient(oauthConfig.LinkedInConsumerKey, oauthConfig.LinkedInConsumerSecret, Views.Literal_OAuth_LinkedIn);
            }

            if (oauthConfig.TwitterEnabled)
            {
                OAuthWebSecurity.RegisterTwitterClient(oauthConfig.TwitterConsumerKey, oauthConfig.TwitterConsumerSecret, Views.Literal_OAuth_Twitter);
            }

            if (oauthConfig.FacebookEnabled)
            {
                OAuthWebSecurity.RegisterFacebookClient(oauthConfig.FacebookAppId, oauthConfig.FacebookAppSecret, Views.Literal_OAuth_Facebook);
            }

            if (oauthConfig.GoogleEnabled)
            {
                OAuthWebSecurity.RegisterGoogleClient(Views.Literal_OAuth_Google);
            }

            if (oauthConfig.YahooEnabled)
            {
                OAuthWebSecurity.RegisterYahooClient(Views.Literal_OAuth_Yahoo);
            }
        }
Esempio n. 3
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            var appSettings = ConfigurationManager.AppSettings;
            Func <string, Dictionary <string, string> > getOAuthSetting = key =>
                                                                          JsonConvert.DeserializeObject <Dictionary <string, string> >(appSettings[key]);

            var oauthMicrosoftSetting = getOAuthSetting("OAuth.Microsoft");

            OAuthWebSecurity.RegisterMicrosoftClient(
                oauthMicrosoftSetting["clientId"],
                oauthMicrosoftSetting["clientSecret"]);

            var oauthTwitterSetting = getOAuthSetting("OAuth.Twitter");

            OAuthWebSecurity.RegisterTwitterClient(
                oauthTwitterSetting["consumerKey"],
                oauthTwitterSetting["consumerSecret"]);

            var oauthFacebookSetting = getOAuthSetting("OAuth.facebook");

            OAuthWebSecurity.RegisterFacebookClient(
                oauthFacebookSetting["appId"],
                oauthFacebookSetting["appSecret"]);

            OAuthWebSecurity.RegisterGoogleClient();

            var oauthGitHubSetting = getOAuthSetting("OAuth.GitHub");

            OAuthWebSecurity.RegisterClient(new GitHubOAuth2Client(
                                                oauthGitHubSetting["clientId"],
                                                oauthGitHubSetting["clientSecret"]), "GitHub", null);
        }
        public static void RegisterAuth()
        {
            string str  = ConfigurationManager.AppSettings.AsString("oauthMicrosoftClientId", null);
            string str2 = ConfigurationManager.AppSettings.AsString("oauthMicrosoftClientSecret", null);

            if (!(string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)))
            {
                OAuthWebSecurity.RegisterMicrosoftClient(str, str2);
            }
            str  = ConfigurationManager.AppSettings.AsString("oauthTwitterConsumerKey", null);
            str2 = ConfigurationManager.AppSettings.AsString("oauthTwitterConsumerSecret", null);
            if (!(string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)))
            {
                OAuthWebSecurity.RegisterTwitterClient(str, str2);
            }
            str  = ConfigurationManager.AppSettings.AsString("oauthFacebookAppId", null);
            str2 = ConfigurationManager.AppSettings.AsString("oauthFacebookAppSecret", null);
            if (!(string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)))
            {
                OAuthWebSecurity.RegisterFacebookClient(str, str2);
            }
            if (ConfigurationManager.AppSettings.AsBool("oauthGoogle", false))
            {
                OAuthWebSecurity.RegisterGoogleClient();
            }
            str  = ConfigurationManager.AppSettings.AsString("oauthVKontakteAppId", null);
            str2 = ConfigurationManager.AppSettings.AsString("oauthVKontakteAppSecret", null);
            if (!(string.IsNullOrEmpty(str) || string.IsNullOrEmpty(str2)))
            {
                IAuthenticationClient client           = new VKontakteAuthenticationClient(str, str2);
                string displayName                     = "VK";
                IDictionary <string, object> extraData = null;
                OAuthWebSecurity.RegisterClient(client, displayName, extraData);
            }
        }
Esempio n. 5
0
 public static void RegisterAuth()
 {
     //OAuthWebSecurity.RegisterClient(new MyMicrosoftClient("000000004810217E", "ynlv5klzgQFjHy4sK3XXRdyYw-oA-Fev", "wl.basic wl.emails"));
     OAuthWebSecurity.RegisterMicrosoftClient(
         clientId: "000000004810217E",
         clientSecret: "ynlv5klzgQFjHy4sK3XXRdyYw-oA-Fev");
 }
Esempio n. 6
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            // https://manage.dev.live.com
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "00000000480F3528",
                clientSecret: "CAogwwIeS3jcJLbb-1GtNT2nzGfqWYMx");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            //OAuthWebSecurity.RegisterLinkedInClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterYahooClient();

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 7
0
        public static void RegisterAuth()
        {
            //This is added to avoid multiple DBContext creation.
            WebSecurity.InitializeDatabaseConnection("DefaultConnection", "Users", "UserId", "UserName", autoCreateTables: true);
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            /*  NOTE: you MUST replace of the xxxxxxxxxxxxxxx's with a valid appId and appSecret for your application
             *  in order to be able to connect!  Also, passing the extra data is only necessary if you want to
             *  show the images for the OpenID provider.
             */

            // Facebook
            OAuthWebSecurity.RegisterFacebookClient(
                appId: "xxxxxxxxxxxxxxx",
                appSecret: "xxxxxxxxxxxxxxx");

            // Twitter
            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "xxxxxxxxxxxxxxx",
                consumerSecret: "xxxxxxxxxxxxxxx");

            // Google
            OAuthWebSecurity.RegisterGoogleClient();

            // Yahoo
            OAuthWebSecurity.RegisterYahooClient();

            // Microsoft Windows Live Id
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "xxxxxxxxxxxxxxx",
                clientSecret: "xxxxxxxxxxxxxxx");
        }
        public void TestRegisterMicrosoftClient()
        {
            // Arrange
            OAuthWebSecurity.RegisterMicrosoftClient("one", "two", displayName: "MS", extraData: null);

            // Act
            var data = OAuthWebSecurity.RegisteredClientData;

            // Assert
            Assert.True(data.IsReadOnly);
            Assert.Equal(1, data.Count);
            Assert.Equal("microsoft", data.First().AuthenticationClient.ProviderName);
            Assert.Equal("MS", data.First().DisplayName);
            Assert.Null(data.First().ExtraData);
        }
Esempio n. 9
0
        public static void RegisterAuth()
        {
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "000000004C10C01A",
                clientSecret: "NQRkZAtTHwjbsIeESF6exh02XPwshsrz");

            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "BH2aXJW3LXxdaYpBdGzQ",
                consumerSecret: "q5fZyWwOEW9mIXVAxRd1VygY0pqUR9HiaA7cQIKZQ");
            OAuthWebSecurity.RegisterFacebookClient(
                appId: "187654464761762",
                appSecret: "62cfd93111645f7a956a0625adc3d2c5");

            OAuthWebSecurity.RegisterGoogleClient();
        }
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: ConfigurationManager.AppSettings["MicrosoftClientId"],
                clientSecret: ConfigurationManager.AppSettings["MicrosoftClientSecret"]);

            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: ConfigurationManager.AppSettings["TwitterConsumerKey"],
                consumerSecret: ConfigurationManager.AppSettings["TwitterConsumerSecret"]);

            OAuthWebSecurity.RegisterFacebookClient(
                appId: ConfigurationManager.AppSettings["FacebookApplicationId"],
                appSecret: ConfigurationManager.AppSettings["FacebookApplicationSecret"]);

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 11
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "00000000400EF579",
                clientSecret: "6KQc3wk1Gbapkqt5taQTnu5kghaX5yz0");

            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "DkHHXTnfqeeVs36LsEDznQ",
                consumerSecret: "FLM48v3AnwhyRWlJd82x9asLrgFUYKhYkcnzYiEBCg");

            OAuthWebSecurity.RegisterFacebookClient(
                appId: "234957339982566",
                appSecret: "a68e8c9fc57dec9283dde2c3f4f2d20e");

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 12
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "000000004C14EC6F",
                clientSecret: "9A7pCh2b-XbKSwBuhvchfMa6FzjQt0IM");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            OAuthWebSecurity.RegisterFacebookClient(
                appId: "346534482222832",
                appSecret: "fdbc7bf2deb8ab3ce121086bb0e40601");

            //  OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 13
0
        public static void RegisterAuth()
        {
            // Para permitir que los usuarios de este sitio inicien sesión con sus cuentas de otros sitios como, por ejemplo, Microsoft, Facebook y Twitter,
            // es necesario actualizar este sitio. Para obtener más información, visite http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "00000000400F57D9",
                clientSecret: "tw0338ub2UqWQKMNGjFrv3g9iz6MGQGJ");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            OAuthWebSecurity.RegisterFacebookClient(
                appId: "475912832481850",
                appSecret: "3479f29ddef3c18656afb8be3e894575");

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 14
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "",
                clientSecret: "");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            //OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 15
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "000000004C0FF117",
                clientSecret: "-WXHKeSgH2wdJLpbr2mFmOD09g4-cgL6");

            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "dRur8eZeyU4cY6cdo8VVFQ",
                consumerSecret: "OegIG39lu6dMGJjVAXySsGHgSpF1UMtBqJGOmnJti4");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 16
0
        public static void RegisterAuth()
        {
            // 若要允许此站点的用户使用他们在其他站点(例如 Microsoft、Facebook 和 Twitter)上拥有的帐户登录,
            // 必须更新此站点。有关详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "aaa",
                clientSecret: "bbb");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //OAuthWebSecurity.RegisterFacebookClient(
            //    appId: "",
            //    appSecret: "");

            //OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 17
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            // Facebook
            Dictionary <string, object> facebookExtraData = new Dictionary <string, object>();

            facebookExtraData.Add("Icon", "../Images/facebook.png");
            OAuthWebSecurity.RegisterFacebookClient(
                appId: "625992587426055",
                appSecret: "917fa69575e8befdebd0cf79988c9c84",

                displayName: "Facebook",
                extraData: facebookExtraData);

            // Google
            Dictionary <string, object> googleExtraData = new Dictionary <string, object>();

            googleExtraData.Add("Icon", "../Images/gplus.png");
            OAuthWebSecurity.RegisterGoogleClient("Google", googleExtraData);

            // Microsoft Windows Live Id
            Dictionary <string, object> microsoftExtraData = new Dictionary <string, object>();

            microsoftExtraData.Add("Icon", "../Images/microsoft.png");
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "00000000401012A6",
                clientSecret: "OFsGrczOKMMQ3ZXw8SGbiCRJY06BSMQ0",
                displayName: "Microsoft",
                extraData: microsoftExtraData);

            // Twitter
            Dictionary <string, object> twitterExtraData = new Dictionary <string, object>();

            twitterExtraData.Add("Icon", "../Images/twitter.png");
            OAuthWebSecurity.RegisterTwitterClient(
                consumerKey: "200897288-xkMPmp4oQnnga28t7oDkJg1yojGyi2UATpgDyFtP",
                consumerSecret: "g9Up7KRFhUFas6AAlISdBo58YnQxyxoZg6tNJBHo",
                displayName: "Twitter",
                extraData: twitterExtraData);
        }
Esempio n. 18
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            var oauthMicrosoftSetting = JsonAppSettings.AsDictionary("OAuth.Microsoft");

            if (oauthMicrosoftSetting != null)
            {
                OAuthWebSecurity.RegisterMicrosoftClient(
                    oauthMicrosoftSetting["clientId"],
                    oauthMicrosoftSetting["clientSecret"]);
            }

            var oauthTwitterSetting = JsonAppSettings.AsDictionary("OAuth.Twitter");

            if (oauthTwitterSetting != null)
            {
                OAuthWebSecurity.RegisterTwitterClient(
                    oauthTwitterSetting["consumerKey"],
                    oauthTwitterSetting["consumerSecret"]);
            }

            var oauthFacebookSetting = JsonAppSettings.AsDictionary("OAuth.facebook");

            if (oauthFacebookSetting != null)
            {
                OAuthWebSecurity.RegisterFacebookClient(
                    oauthFacebookSetting["appId"],
                    oauthFacebookSetting["appSecret"]);
            }

            OAuthWebSecurity.RegisterGoogleClient();

            // TODO: GitHub Account Support.
            //var oauthGitHubSetting = JsonAppSettings.AsDictionary("OAuth.GitHub");
            //OAuthWebSecurity.RegisterClient(new GitHubOAuth2Client(
            //    oauthGitHubSetting["clientId"],
            //    oauthGitHubSetting["clientSecret"]), "GitHub", null);
        }
Esempio n. 19
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            //P@$$word1 - James Bonda - [email protected]
            OAuthWebSecurity.RegisterMicrosoftClient(
                clientId: "0000000040140814",
                clientSecret: "QkX9bqz0h1kE-wB5aDluDVoWp6UEXh9T");

            //OAuthWebSecurity.RegisterTwitterClient(
            //    consumerKey: "",
            //    consumerSecret: "");

            //P@$$word1 - James Bonda
            OAuthWebSecurity.RegisterFacebookClient(
                appId: "541694889266197",
                appSecret: "35fd71113ae77e5329ecf8001c7f12c1");

            OAuthWebSecurity.RegisterGoogleClient();

            OAuthWebSecurity.RegisterYahooClient();
        }
Esempio n. 20
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            var microsoftClientId     = WebConfigurationManager.AppSettings["microsoftClientId"];
            var microsoftClientSecret = WebConfigurationManager.AppSettings["microsoftClientSecret"];

            if (!string.IsNullOrEmpty(microsoftClientId) && !string.IsNullOrEmpty(microsoftClientSecret))
            {
                OAuthWebSecurity.RegisterMicrosoftClient(
                    clientId: microsoftClientId,
                    clientSecret: microsoftClientSecret);
            }

            var twitterConsumerKey    = WebConfigurationManager.AppSettings["twitterConsumerKey"];
            var twitterConsumerSecret = WebConfigurationManager.AppSettings["twitterConsumerSecret"];

            if (!string.IsNullOrEmpty(twitterConsumerKey) && !string.IsNullOrEmpty(twitterConsumerSecret))
            {
                OAuthWebSecurity.RegisterTwitterClient(
                    consumerKey: twitterConsumerKey,
                    consumerSecret: twitterConsumerSecret);
            }

            var facebookAppId     = WebConfigurationManager.AppSettings["facebookAppId"];
            var facebookAppSecret = WebConfigurationManager.AppSettings["facebookAppSecret"];

            if (!string.IsNullOrEmpty(facebookAppId) && !string.IsNullOrEmpty(facebookAppSecret))
            {
                OAuthWebSecurity.RegisterFacebookClient(
                    appId: facebookAppId,
                    appSecret: facebookAppSecret);
            }

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 21
0
        public static void RegisterAuth()
        {
            // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
            // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

            OAuthWebSecurity.RegisterMicrosoftClient(
                OAuthSettingsProvider.Settings["microsoft"].Id,
                OAuthSettingsProvider.Settings["microsoft"].Secret
                //clientId: "0000000040107204",
                //clientSecret: "et9apWcCzqm8ODXYgy53XooaBsw1C895"
                );

            OAuthWebSecurity.RegisterTwitterClient(
                OAuthSettingsProvider.Settings["twitter"].Id,
                OAuthSettingsProvider.Settings["twitter"].Secret

                //consumerKey: "CnZYU2EWrCSgQ95INafrw",
                //consumerSecret: "gOP6mE7RP3dGLDdFOnHqyueyDhbCFl37wa4R0uNpzE"
                );

            OAuthWebSecurity.RegisterLinkedInClient(
                OAuthSettingsProvider.Settings["linkedin"].Id,
                OAuthSettingsProvider.Settings["linkedin"].Secret);

            OAuthWebSecurity.RegisterFacebookClient(
                OAuthSettingsProvider.Settings["facebook"].Id,
                OAuthSettingsProvider.Settings["facebook"].Secret

                //appId: "239932299490730",
                //appSecret: "d01d385c9449fc5cb1c09c9e4c70a55d"
                );

            OAuthWebSecurity.RegisterYahooClient();

            OAuthWebSecurity.RegisterGoogleClient();
        }
Esempio n. 22
0
 public static void RegisterAuth()
 {
     OAuthWebSecurity.RegisterMicrosoftClient(
         clientId: "00000000400F8C05",
         clientSecret: "bll3xF4lvpaWQdgrtgL7BP6VpKkzXuD1");
 }
Esempio n. 23
0
 private static void RegisterMSClient()
 {
     OAuthWebSecurity.RegisterMicrosoftClient(
         clientId: "",
         clientSecret: "");
 }