• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Facebook.FacebookAuthenticationOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Owin.Security.Facebook.FacebookAuthenticationOptions的典型用法代码示例。如果您正苦于以下问题:C# FacebookAuthenticationOptions类的具体用法?C# FacebookAuthenticationOptions怎么用?C# FacebookAuthenticationOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FacebookAuthenticationOptions类属于Microsoft.Owin.Security.Facebook命名空间,在下文中一共展示了FacebookAuthenticationOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConfigureOAuth

        public void ConfigureOAuth(IAppBuilder app)
        {
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

            OAuthAuthorizationServerOptions oAuthServerOptions = new OAuthAuthorizationServerOptions() {
                AllowInsecureHttp = true,
                TokenEndpointPath = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
                Provider = new SimpleAuthorizationServerProvider(),
                RefreshTokenProvider = new SimpleRefreshTokenProvider()
            };

            // Token Generation
            app.UseOAuthAuthorizationServer(oAuthServerOptions);
            app.UseOAuthBearerAuthentication(OAuthBearerOptions);

            //Configure Google External Login
            googleAuthOptions = new GoogleOAuth2AuthenticationOptions() {
                ClientId = "xxx",
                ClientSecret = "xxx",
                Provider = new GoogleAuthProvider()
            };
            app.UseGoogleAuthentication(googleAuthOptions);

            //Configure Facebook External Login
            facebookAuthOptions = new FacebookAuthenticationOptions() {
                AppId = "xxx",
                AppSecret = "xxx",
                Provider = new FacebookAuthProvider()
            };
            app.UseFacebookAuthentication(facebookAuthOptions);
        }
开发者ID:kottt,项目名称:OAuthPrototype,代码行数:33,代码来源:Startup.cs


示例2: ConfigureSocialIdentityProviders

        public static void ConfigureSocialIdentityProviders(IAppBuilder app, string signInAsType)
        {
            var google = new GoogleAuthenticationOptions
            {
                AuthenticationType = "Google",
                SignInAsAuthenticationType = signInAsType
            };
            app.UseGoogleAuthentication(google);

            var fb = new FacebookAuthenticationOptions
            {
                AuthenticationType = "Facebook",
                SignInAsAuthenticationType = signInAsType,
                AppId = "676607329068058",
                AppSecret = "9d6ab75f921942e61fb43a9b1fc25c63"
            };
            app.UseFacebookAuthentication(fb);

            var twitter = new TwitterAuthenticationOptions
            {
                AuthenticationType = "Twitter",
                SignInAsAuthenticationType = signInAsType,
                ConsumerKey = "N8r8w7PIepwtZZwtH066kMlmq",
                ConsumerSecret = "df15L2x6kNI50E4PYcHS0ImBQlcGIt6huET8gQN41VFpUCwNjM"
            };
            app.UseTwitterAuthentication(twitter);
        }
开发者ID:vobreshkov,项目名称:Thinktecture.IdentityServer.v3,代码行数:27,代码来源:Startup.cs


示例3: GetFacebookOptions

        private static FacebookAuthenticationOptions GetFacebookOptions()
        {
            var facebookOptions = new FacebookAuthenticationOptions
            {
                AppId = "716319181763981",
                AppSecret = "48e5e982f464d6a9ce610fdca6d2eaa2"
            };
            facebookOptions.Scope.Add("email");
            //facebookOptions.Provider = new FacebookAuthenticationProvider
            //{
            //	OnAuthenticated = async context =>
            //	{
            //		context.Identity.AddClaim(new Claim("AccessToken", context.AccessToken));
            //		context.Identity.AddClaim(new Claim("Id", context.Id));
            //		context.Identity.AddClaim(new Claim("FullName", context.User["name"].ToString()));
            //		context.Identity.AddClaim(new Claim("FirstName", context.User["first_name"].ToString()));
            //		context.Identity.AddClaim(new Claim("LastName", context.User["last_name"].ToString()));
            //		context.Identity.AddClaim(new Claim("Nickname", string.Empty));
            //		context.Identity.AddClaim(new Claim("PhotoLink", string.Format("https://graph.facebook.com/{0}/picture", context.Id)));
            //		context.Identity.AddClaim(new Claim("Email", context.Email));
            //	}
            //};

            return facebookOptions;
        }
开发者ID:Dmitry-Ustimenko,项目名称:lsdteam,代码行数:25,代码来源:Startup.cs


示例4: ConfigureAuth

        // Дополнительные сведения о настройке проверки подлинности см. по адресу: http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Включение использования файла cookie, в котором приложение может хранить информацию для пользователя, выполнившего вход,
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Раскомментируйте приведенные далее строки, чтобы включить вход с помощью сторонних поставщиков входа
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            var x = new FacebookAuthenticationOptions();
            x.Scope.Add("email");
            x.AppId = "698020986995763";
            x.AppSecret = "1e506a050e170e62cb516d065305d81c";
            app.UseFacebookAuthentication(x);

            app.UseGoogleAuthentication(
                clientId: "813562463354-ir13fejg31gfmbb5utv4854m13ft7c6e.apps.googleusercontent.com",
                clientSecret: "dj26JLnwGgXKJS6xB40O0hJU");
        }
开发者ID:wsbaser,项目名称:CoolVocabulary,代码行数:31,代码来源:Startup.Auth.cs


示例5: ChallengeWillTriggerApplyRedirectEvent

 public async Task ChallengeWillTriggerApplyRedirectEvent()
 {
     var options = new FacebookAuthenticationOptions()
     {
         AppId = "Test App Id",
         AppSecret = "Test App Secret",
         Provider = new FacebookAuthenticationProvider
         {
             OnApplyRedirect = context =>
             {
                 context.Response.Redirect(context.RedirectUri + "&custom=test");
             }
         }
     };
     var server = CreateServer(
         app => app.UseFacebookAuthentication(options),
         context =>
         {
             context.Authentication.Challenge("Facebook");
             return true;
         });
     var transaction = await SendAsync(server, "http://example.com/challenge");
     transaction.Response.StatusCode.ShouldBe(HttpStatusCode.Redirect);
     var query = transaction.Response.Headers.Location.Query;
     query.ShouldContain("custom=test");
 }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:26,代码来源:FacebookMiddlewareTests.cs


示例6: Configure

        public static void Configure(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
              AuthenticationType = DefaultAuthenticationTypes.ExternalCookie
            });

            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Configure google authentication
            var options = new GoogleOAuth2AuthenticationOptions()
            {
              ClientId = "your app client id",
              ClientSecret = "your app client secret"
            };

            app.UseGoogleAuthentication(options);

            facebookAuthOptions = new FacebookAuthenticationOptions()
            {
            AppId = "528982800546743",
            AppSecret = "a6ee5ad8448c7c67fcedc72d5a4c501a",
            Provider = new FacebookAuthProvider()
            };

            app.UseFacebookAuthentication(facebookAuthOptions);
        }
开发者ID:ozotony,项目名称:UPS,代码行数:29,代码来源:SecurityConfig+.cs


示例7: ConfigureOAuth

        private void ConfigureOAuth(IAppBuilder app)
        {
            app.UseExternalSignInCookie(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie);
            OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

            OAuthAuthorizationServerOptions oAuthServerOptions = new OAuthAuthorizationServerOptions()
            {
                AllowInsecureHttp = true,
                TokenEndpointPath = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
                Provider = new SimpleAuthorizationServerProvider(new AccountRepository())
            };

            GoogleAuthOptions = new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "592613624399-a3gr6vveaocnptgvv6738rmnk0pb5cev.apps.googleusercontent.com",
                ClientSecret = "FqNKKib_BP7dsNYBoJa8NwUC",
                Provider = new GoogleAuthProvider()
            };
            app.UseGoogleAuthentication(GoogleAuthOptions);

            FacebookAuthOptions = new FacebookAuthenticationOptions()
            {
                AppId = "806191272841558",
                AppSecret = "1a8241e9d46c4a5e393ae51f265a3489",
                Provider = new FacebookAuthProvider()
            };
            app.UseFacebookAuthentication(FacebookAuthOptions);

            // Token Generation
            app.UseOAuthAuthorizationServer(oAuthServerOptions);
            app.UseOAuthBearerAuthentication(OAuthBearerOptions);
        }
开发者ID:danthomas,项目名称:AngularJSAuthentication,代码行数:33,代码来源:Startup.cs


示例8: ConfigureAuth

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            var facebookAuthenticationOptions = new FacebookAuthenticationOptions()
            {
                AppId = "1610907412530093",
                AppSecret = "c1bf0fa3ed887572a54a21a3ab2f2082"
            };
            facebookAuthenticationOptions.Scope.Add("email");
            app.UseFacebookAuthentication(facebookAuthenticationOptions);

            app.UseGoogleAuthentication(
                clientId: "327546397623-h7gvq4pt4llsasl65pmd0osuddim2r8s.apps.googleusercontent.com",
                clientSecret: "kGGXUiz8aBM1B8X0g-r8iFHT");
        }
开发者ID:anttross,项目名称:events,代码行数:33,代码来源:Startup.Auth.cs


示例9: ConfigureAdditionalIdentityProviders

        public static void ConfigureAdditionalIdentityProviders(IAppBuilder app, string signInAsType)
        {
            var google = new GoogleOAuth2AuthenticationOptions
            {
                AuthenticationType = "Google",
                SignInAsAuthenticationType = signInAsType,
                ClientId = "client", //"767400843187-8boio83mb57ruogr9af9ut09fkg56b27.apps.googleusercontent.com",
                ClientSecret = "secret"  //"5fWcBT0udKY7_b6E3gEiJlze"
            };
            app.UseGoogleAuthentication(google);

            var fb = new FacebookAuthenticationOptions
            {
                AuthenticationType = "Facebook",
                SignInAsAuthenticationType = signInAsType,
                AppId = "app", //"676607329068058",
                AppSecret = "secret"  //"9d6ab75f921942e61fb43a9b1fc25c63"
            };
            app.UseFacebookAuthentication(fb);

            var twitter = new TwitterAuthenticationOptions
            {
                AuthenticationType = "Twitter",
                SignInAsAuthenticationType = signInAsType,
                ConsumerKey = "consumer",  //"N8r8w7PIepwtZZwtH066kMlmq",
                ConsumerSecret = "secret"  //"df15L2x6kNI50E4PYcHS0ImBQlcGIt6huET8gQN41VFpUCwNjM"
            };
            app.UseTwitterAuthentication(twitter);
        }
开发者ID:geffzhang,项目名称:SLEEK-UserAuth,代码行数:29,代码来源:Startup.cs


示例10: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app)
        {
            if (_thirdPartyAuthSettings.LinkedInEnabled
                 && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.LinkedInClientId)
                 && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.LinkedInClientSecret))
            {
                app.UseLinkedInAuthentication(clientId: _thirdPartyAuthSettings.LinkedInClientId,
                    clientSecret: _thirdPartyAuthSettings.LinkedInClientSecret);
            }

            if (_thirdPartyAuthSettings.FacebookEnabled
                 && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.FacebookAppId)
                 && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.FacebookAppSecret))
            {
                var facebookAuthenticationOptions = new FacebookAuthenticationOptions
                                                    {
                                                        AppId = _thirdPartyAuthSettings.FacebookAppId,
                                                        AppSecret = _thirdPartyAuthSettings.FacebookAppSecret,
                                                    };
                facebookAuthenticationOptions.Scope.Add("email");
                app.UseFacebookAuthentication(facebookAuthenticationOptions);
            }
            if (_thirdPartyAuthSettings.GoogleEnabled
                    && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.GoogleClientSecret)
                    && !string.IsNullOrWhiteSpace(_thirdPartyAuthSettings.GoogleClientId))
            {
                app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
                  {
                      ClientId = _thirdPartyAuthSettings.GoogleClientId,
                      ClientSecret = _thirdPartyAuthSettings.GoogleClientSecret,
                  });
            }
        }
开发者ID:neozhu,项目名称:MrCMS,代码行数:33,代码来源:AuthConfigurationService.cs


示例11: ConfigureAuth

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            //app.UseFacebookAuthentication(
            //   appId: "",
            //   appSecret: "");

            var facebookAuthenticationOptions = new FacebookAuthenticationOptions
            {
                AppId = "1480656632147712",
                AppSecret = "971e8d74e63d9a6a5e676bebd5c134ff"
            };
            facebookAuthenticationOptions.Scope.Add("email");
            app.UseFacebookAuthentication(facebookAuthenticationOptions);

            app.UseGoogleAuthentication();
        }
开发者ID:cbenitezatnetmark,项目名称:TechDaysMVC5,代码行数:35,代码来源:Startup.Auth.cs


示例12: ConfigureOAuth

        public void ConfigureOAuth(IAppBuilder app)
        {
            //use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie);
            OAuthBearerOptions = new OAuthBearerAuthenticationOptions();

            OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions() {
            
                AllowInsecureHttp = true,
                TokenEndpointPath = new PathString("/token"),
                AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
                Provider = new SimpleAuthorizationServerProvider(),
                RefreshTokenProvider = new SimpleRefreshTokenProvider()
            };

            // Token Generation
            app.UseOAuthAuthorizationServer(OAuthServerOptions);
            app.UseOAuthBearerAuthentication(OAuthBearerOptions);

            //Configure Google External Login
            googleAuthOptions = new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "xxxxxx",
                ClientSecret = "xxxxxx",
                Provider = new GoogleAuthProvider()
            };
            app.UseGoogleAuthentication(googleAuthOptions);

            //Configure Facebook External Login
            facebookAuthOptions = new FacebookAuthenticationOptions()
            {
                AppId = System.Configuration.ConfigurationManager.AppSettings["FacebookAppId"],
                AppSecret = System.Configuration.ConfigurationManager.AppSettings["FacebookAppSecret"],
                Provider = new FacebookAuthProvider()
            };
            app.UseFacebookAuthentication(facebookAuthOptions);

            //Configure Twitter External Login
           twitterAuthOptions = new TwitterAuthenticationOptions()
            {
                ConsumerKey = System.Configuration.ConfigurationManager.AppSettings["TwitterConsumerKey"],
                ConsumerSecret = System.Configuration.ConfigurationManager.AppSettings["TwitterConsumerSecret"],
                Provider = new TwitterAuthProvider()
            };
           app.UseTwitterAuthentication(twitterAuthOptions);

           //Configure LinkedIn External Login
           linkedinAuthOptions = new LinkedInAuthenticationOptions()
           {

               ClientId = System.Configuration.ConfigurationManager.AppSettings["LinkedInClientId"],
               ClientSecret = System.Configuration.ConfigurationManager.AppSettings["LinkedInSecret"],
               Provider = new LinkedInAuthProvider()
           };
           app.UseLinkedInAuthentication(linkedinAuthOptions);

           

        }
开发者ID:joropeza,项目名称:AspNetAuth,代码行数:59,代码来源:Startup.cs


示例13: ConfigureAuth

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Configure the db context, user manager and signin manager to use a single instance per request
            app.CreatePerOwinContext(IGDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            // Configure the sign in cookie
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Enables the application to validate the security stamp when the user logs in.
                    // This is a security feature which is used when you change a password or add an external login to your account.
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Enables the application to remember the second login verification factor such as phone or email.
            // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
            // This is similar to the RememberMe option when you log in.
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

            var facebookOptions = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationOptions()
            {
                AppId = ConfigurationManager.AppSettings.Get("FacebookAppId"),
                AppSecret = ConfigurationManager.AppSettings.Get("FacebookAppSecret"),
                Provider = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationProvider()
                {
                    OnAuthenticated = (context) =>
                    {
                        var deserializedUser = JsonConvert.DeserializeObject<FacebookAuthenticatedContextUserModel>(context.User.ToString());

                        context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:access_token", context.AccessToken, XmlSchemaString, "Facebook"));
                        context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:email", context.Email, XmlSchemaString, "Facebook"));
                        context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:first_name", deserializedUser.first_name, XmlSchemaString, "Facebook"));
                        context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:last_name", deserializedUser.last_name, XmlSchemaString, "Facebook"));
                        context.Identity.AddClaim(new System.Security.Claims.Claim("urn:facebook:location", deserializedUser.location.name, XmlSchemaString, "Facebook"));
                        return Task.FromResult(0);
                    }
                }

            };

            facebookOptions.Scope.Add("email");

            app.UseFacebookAuthentication(facebookOptions);
        }
开发者ID:r3wind,项目名称:imgame1,代码行数:59,代码来源:Startup.Auth.cs


示例14: ConfigureAuth

        private void ConfigureAuth(IAppBuilder app)
        {
            app.CreatePerOwinContext(() => new SmartConnectDbContext());
            app.CreatePerOwinContext(
                (IdentityFactoryOptions<SmartConnectUserManager> options, IOwinContext context) =>
                new SmartConnectUserManager(
                    new UserStore<User>(context.Get<SmartConnectDbContext>()),
                    options));
            app.CreatePerOwinContext(
                (IdentityFactoryOptions<SmartConnectSignInManager> options, IOwinContext context) =>
                new SmartConnectSignInManager(
                    context.GetUserManager<SmartConnectUserManager>(),
                    context.Authentication));

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<SmartConnectUserManager, User>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            var facebookOptions = new FacebookAuthenticationOptions()
            {
                AppId = "985705804847366",
                AppSecret = "60f3dd8843d253be4df4c7df53dda6e5",
                BackchannelHttpHandler = new FacebookBackchannelHandler(),
                UserInformationEndpoint = "https://graph.facebook.com/v2.4/me?fields=id,name,email,first_name,last_name,location"
            };

            facebookOptions.Scope.Add("email");
            app.UseFacebookAuthentication(facebookOptions);

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "223740515644-941v7r26af6sjl5rdsb1oupkcn85mob6.apps.googleusercontent.com",
                ClientSecret = "44TORONTMTTGYpg5j1GcEULS"
            });

            app.MapSignalR();
        }
开发者ID:vassildinev,项目名称:Smart-Connect,代码行数:58,代码来源:Startup.cs


示例15: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Login/SignIn")
            });

            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Configure social authentication: Twitter
            var naaeTwitterKey = ConfigurationManager.AppSettings["naa4e:twitter:key"];
            var naaeTwitterSecret = ConfigurationManager.AppSettings["naa4e:twitter:sec"];
            if (!Globals.IsAnyNullOrEmpty(naaeTwitterKey, naaeTwitterSecret))
            {
                var twitterOptions = new TwitterAuthenticationOptions
                {
                    ConsumerKey = naaeTwitterKey,
                    ConsumerSecret = naaeTwitterSecret,
                    Provider = new TwitterAuthenticationProvider()
                    {
                        OnAuthenticated = (context) =>
                        {
                            context.Identity.AddClaim(new Claim("urn:tokens:twitter:accesstoken", context.AccessToken));
                            context.Identity.AddClaim(new Claim("urn:tokens:twitter:accesstokensecret", context.AccessTokenSecret));
                            return Task.FromResult(0);
                        }
                    }
                };
                app.UseTwitterAuthentication(twitterOptions);
            }

            // Configure social authentication: Facebook
            var naaeFbKey = ConfigurationManager.AppSettings["naa4e:fb:key"];
            var naaeFbSecret = ConfigurationManager.AppSettings["naa4e:fb:sec"];
            if (!Globals.IsAnyNullOrEmpty(naaeFbKey, naaeFbSecret))
            {
                var fbOptions = new FacebookAuthenticationOptions
                {
                    AppId = naaeFbKey,
                    AppSecret = naaeFbSecret,
                    Provider = new FacebookAuthenticationProvider
                    {
                        OnAuthenticated = (context) =>
                        {
                            // Gives you email, ID (to get profile pic), full name, and more
                            context.Identity.AddClaim(new Claim("urn:facebook:access_token", context.AccessToken));  
                            context.Identity.AddClaim(new Claim("urn:facebook:email", context.Email));
                            return Task.FromResult(0);
                        }
                    }
                };
                fbOptions.Scope.Add("email");
                app.UseFacebookAuthentication(fbOptions);
            }
        }
开发者ID:pachinko,项目名称:naa4e,代码行数:58,代码来源:Startup.cs


示例16: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app)
        {
            // app.CreatePerOwinContext(XcendentAuthContext.Create);
            //app.CreatePerOwinContext<XcendentUserManager>(XcendentUserManager.Create);

            app.UseCors(CorsOptions.AllowAll);

            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);


            PublicClientId = "self";

            OAuthOptions = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath = new PathString("/Token"),
                Provider = new XcendentOAuthProvider(PublicClientId),
                AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                // In production mode set AllowInsecureHttp = false
                AllowInsecureHttp = true
            };

            app.UseOAuthBearerTokens(OAuthOptions);


            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //    consumerKey: "",
            //    consumerSecret: "");


            FacebookAuthenticationOptions facebookAuthOptions = new FacebookAuthenticationOptions()
            {
                AppId = "553074264845816",
                AppSecret = "c71200f8ba3d48f92433c9e1844a7239",
                Provider = new FacebookAuthProvider()
            };
            //  facebookAuthOptions.Scope.Clear();
            facebookAuthOptions.Scope.Add("public_profile");
            facebookAuthOptions.Scope.Add("email");
            app.UseFacebookAuthentication(facebookAuthOptions);
            GoogleOAuth2AuthenticationOptions googleOptions = new GoogleOAuth2AuthenticationOptions();
            googleOptions.Scope.Clear();
            googleOptions.Scope.Add("profile");
            googleOptions.Scope.Add("email");
            googleOptions.ClientId = "141496314941-4bc07d10tkmctlrcb0ealjp0n45d04dl.apps.googleusercontent.com";
            googleOptions.ClientSecret = "UWQkdq18I3VB7udh3aBsxOK9";
            googleOptions.Provider = new GoogleAuthProvider();
            googleOptions.AccessType = "online";
            //  googleOptions.AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive;

            app.UseGoogleAuthentication(googleOptions);
        }
开发者ID:nandithakw,项目名称:hasl,代码行数:58,代码来源:Startup.Auth.cs


示例17: ConfigureAuth

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Configure the db context, user manager and signin manager to use a single instance per request
            app.CreatePerOwinContext(PhotoContestDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            // Configure the sign in cookie
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Enables the application to validate the security stamp when the user logs in.
                    // This is a security feature which is used when you change a password or add an external login to your account.
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Enables the application to temporarily store user information when they are verifying the second factor in the two-factor authentication process.
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Enables the application to remember the second login verification factor such as phone or email.
            // Once you check this option, your second step of verification during the login process will be remembered on the device where you logged in from.
            // This is similar to the RememberMe option when you log in.
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            var fb = new FacebookAuthenticationOptions()
            {
                AppId = "721346014663974",
                AppSecret = "ec17ec8d4f8048fc230a61125c4e2aab"
            };
            //fb.Scope.Add("email");
            app.UseFacebookAuthentication(fb);

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "872576441375-fp1lekqch5bogrmust1tb6ejj51i8msr.apps.googleusercontent.com",
                ClientSecret = "R_sfiuNFbzJWSBkMf0RDD7pz"
            });
        }
开发者ID:TeamDAYANTRET,项目名称:PhotoContest,代码行数:57,代码来源:Startup.Auth.cs


示例18: EnableFacebookAuth

        private static void EnableFacebookAuth(IAppBuilder app)
        {
            var facebookAuthOpt = new FacebookAuthenticationOptions();
            facebookAuthOpt.AppId = Credentials.Facebook_Id;
            facebookAuthOpt.AppSecret = Credentials.Facebook_Secret;
            facebookAuthOpt.Scope.Add("email");
            facebookAuthOpt.Provider = new FacebookOAuthProvider();

            app.UseFacebookAuthentication(facebookAuthOpt);
        }
开发者ID:supperslonic,项目名称:SupperSlonicWebSite,代码行数:10,代码来源:Startup.Auth.cs


示例19: ConfigureAuth

 public override void ConfigureAuth(IAppBuilder app)
 {
     FacebookAuthenticationOptions opt=new FacebookAuthenticationOptions()
     {
         AppId = ConfigurationLoader.GetConfiguration("Facebook-AppID"),
         AppSecret = ConfigurationLoader.GetConfiguration("Facebook-AppSecret")
     };
     opt.Scope.Add("email");
     app.UseFacebookAuthentication(opt);
 }
开发者ID:kyasbal-1994,项目名称:linophi,代码行数:10,代码来源:OAuthAuthenticationConfiguratorManager.cs


示例20: ConfigureAuth


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Google.GoogleOAuth2AuthenticationOptions类代码示例发布时间:2022-05-26
下一篇:
C# Security.AuthenticationTicket类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap