当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.UseVkontakteAuthentication方法代码示例

本文整理汇总了C#中IAppBuilder.UseVkontakteAuthentication方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseVkontakteAuthentication方法的具体用法?C# IAppBuilder.UseVkontakteAuthentication怎么用?C# IAppBuilder.UseVkontakteAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseVkontakteAuthentication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider
            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: "");

            //app.UseGoogleAuthentication();
            app.UseVkontakteAuthentication("3857862", "NQMUvRUnc9DsMQz8jxiO", "notify");
        }
开发者ID:rallysportphoto,项目名称:Portal,代码行数:29,代码来源:Startup.Auth.cs

示例2: ConfigureAuth

        public void ConfigureAuth(IAppBuilder app)
        {
            app.UseExternalSignInCookie("ExternalCookie");

            // App.Secrets is application specific and holds values in CodePasteKeys.json
            // Values are NOT included in repro – auto-created on first load
            app.UseVkontakteAuthentication(
               appId: "5357653",
               appSecret: "CqMDX2wGJDCBzeLkyFjS",
               scope: "email"
            );

            app.UseGoogleAuthentication(
                clientId: "1234",
                clientSecret: "1234"
            );

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

            app.UseMicrosoftAccountAuthentication(
                clientId: "1234",
                clientSecret: "1234"
            );

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

            AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;
        }
开发者ID:denismaster,项目名称:dotnet01,代码行数:34,代码来源:Startup.cs

示例3: ConfigureAuth

        private void ConfigureAuth(IAppBuilder app)
        {
            var authConfig = (VkConfiguration)ConfigurationManager.GetSection(VkConfiguration.SectionName);
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                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<UserManager<ApplicationUser, int>, ApplicationUser, int>(
                        TimeSpan.FromMinutes(30),
                        (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie),
                        ci =>
                        {
                            var idClaim = ci.Claims.First(c => c.Type == VkConstants.ClaimTypes.Id);
                            return int.Parse(idClaim.Value);
                        })
                }
            });
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

            app.UseVkontakteAuthentication(authConfig.ApplicationId, authConfig.ApplicationKey, authConfig.ApplicationPermissions);
        }
开发者ID:Agaspher20,项目名称:VkPostAnalyser,代码行数:26,代码来源:Startup.AuthConfig.cs

示例4: 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(ApplicationDbContext.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: "");

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

            app.UseVkontakteAuthentication("5112234", "JvaTsbEcO8FQz7LL0Tr4", "friends,video");

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "869908290164-kbbh0jd8j1fou5s55jinclcmhc97umof.apps.googleusercontent.com",
                ClientSecret = "W1J59IXgjK2mLFNwBJHuZlVY"
            });
        }
开发者ID:reaver89,项目名称:PostReader,代码行数:55,代码来源:Startup.Auth.cs

示例5: ConfigureAuth

        // Дополнительные сведения о настройке проверки подлинности см. по адресу: http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder OAuthWebSecurity)
        {
            // Настройка контекста базы данных, диспетчера пользователей и диспетчера входа для использования одного экземпляра на запрос
            OAuthWebSecurity.CreatePerOwinContext(ApplicationDbContext.Create);
            OAuthWebSecurity.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            OAuthWebSecurity.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

            // Включение использования файла cookie, в котором приложение может хранить информацию для пользователя, выполнившего вход,
            // и использование файла cookie для временного хранения информации о входах пользователя с помощью стороннего поставщика входа
            // Настройка файла cookie для входа
            OAuthWebSecurity.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Позволяет приложению проверять метку безопасности при входе пользователя.
                    // Эта функция безопасности используется, когда вы меняете пароль или добавляете внешнее имя входа в свою учетную запись.
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });
            OAuthWebSecurity.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Позволяет приложению временно хранить информацию о пользователе, пока проверяется второй фактор двухфакторной проверки подлинности.
            OAuthWebSecurity.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Позволяет приложению запомнить второй фактор проверки имени входа. Например, это может быть телефон или почта.
            // Если выбрать этот параметр, то на устройстве, с помощью которого вы входите, будет сохранен второй шаг проверки при входе.
            // Точно так же действует параметр RememberMe при входе.
            OAuthWebSecurity.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

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

            OAuthWebSecurity.UseVkontakteAuthentication( "5113003","4eYKFE7qBhwqTQxl47km", "https://localhost:44300/");
            OAuthWebSecurity.UseTwitterAuthentication(
               consumerKey: "QnvOrpYSH9SleYZFBzjOKv2vV",
               consumerSecret: "NVv85MSymvY1mf6EOKA0p2hW2I9CkzKWa1c7Kea1Snrhnmk5pl");

            OAuthWebSecurity.UseFacebookAuthentication(
               appId: "1657999054466820",
               appSecret: "583f7acff538b854a046af0a96a2ae50");

            OAuthWebSecurity.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "9761158728-vdd25674r3f8qe2v0d617f58guknbv7r.apps.googleusercontent.com",
                ClientSecret = "4rkVdE2dLN6A8uyyMsSvaIHn"
            });
        }
开发者ID:Pryanic,项目名称:TimeBank13,代码行数:54,代码来源:Startup.Auth.cs

示例6: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                CookieName = AppConfig.CookieName,
                ExpireTimeSpan = new TimeSpan(7, 0, 0, 0),
                LoginPath = new PathString(WebBuilder.BuildActionUrl<HomeController>(o => o.Index()))
            });

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            app.UseFacebookAuthentication(GetFacebookOptions());
            app.UseVkontakteAuthentication(GetVKontakteOptions());
        }
开发者ID:Dmitry-Ustimenko,项目名称:lsdteam,代码行数:15,代码来源:Startup.cs

示例7: ConfigureAuth

        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationManager>(ApplicationManager.Create);
            app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.Create);

            // 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"),
                Provider = new CookieAuthenticationProvider
                {
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            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: "1",
            //    clientSecret: "1");

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

            app.UseVkontakteAuthentication(
                appId: "5156845",
                appSecret: "8Hemd2abJ16j2AkfAnTd",
                scope: "friends,messages"
                );

            app.UseFacebookAuthentication(
               appId: "1503375426626051",
               appSecret: "fac92f5822659cc8c53fbd7d78ace976");

            ////app.UseGoogleAuthentication();
            app.UseGoogleAuthentication(
                 clientId: "270937924175-hofbao9g229vg3kfo5q3d9cf2a7ncct1.apps.googleusercontent.com",
                 clientSecret: "jEH8nEyOiOQnZv73Axk9O9e5");
        }
开发者ID:Shiloff,项目名称:Terem,代码行数:48,代码来源:Startup.Auth.cs

示例8: 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(ApplicationDbContext.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(new TwitterAuthenticationOptions {
               ConsumerKey= "dQqy5fDOVtkj4q8gJHajWSNku",
               ConsumerSecret= "bPWadI7teNoQY466wsxzY5TkkffTzizo8Y59Zj5Rj0l9CVxRqk",
               BackchannelCertificateValidator = new CertificateSubjectKeyIdentifierValidator(
new[]
{
"A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2 
"0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3 
"7FD365A7C2DDECBBF03009F34339FA02AF333133", // VeriSign Class 3 Public Primary Certification Authority - G5 
"39A55D933676616E73A761DFA16A7E59CDE66FAD", // Symantec Class 3 Secure Server CA - G4 
"4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5", // VeriSign Class 3 Primary CA - G5 
"5168FF90AF0207753CCCD9656462A212B859723B", // DigiCert SHA2 High Assurance Server CA 
"B13EC36903F8BF4701D498261A0802EF63642BC3", // DigiCert High Assurance EV Root CA 
"B77DDB6867D3B325E01C90793413E15BF0E44DF2"
})
               });

            app.UseFacebookAuthentication(
               appId: "823839521057747",
               appSecret: "939fcfaf59c34bb8967553b0e8337ba9");

            //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            //{
            //    ClientId = "",
            //    ClientSecret = ""
            //});
            app.UseVkontakteAuthentication("5272668", "tky4WngIs9mei5sKD4js", "Email");
        }
开发者ID:akostiv,项目名称:creatives,代码行数:67,代码来源:Startup.Auth.cs

示例9: 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"),
                //ExpireTimeSpan = new TimeSpan(1,0,0,0),
                CookieName = "AuthCoockie",
                //   ExpireTimeSpan = new TimeSpan(1)
                //CookieSecure = CookieSecureOption.Always,

            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.UseVkontakteAuthentication(
                "4832199",
                "AmfedoaOETi6tvuyri7u",
                "friends,audio");

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "22880875754-4jpc5372j5r1fd84fd3oj2fjuj2krnaf.apps.googleusercontent.com",
                ClientSecret = "1KsGS7VW_Kpf2w3o2ZxDEoCb"
            });
            // 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: "");

            //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions
            //{
            //    ClientId = "22880875754-4jpc5372j5r1fd84fd3oj2fjuj2krnaf.apps.googleusercontent.com",
            //    ClientSecret = "1KsGS7VW_Kpf2w3o2ZxDEoCb"
            //});

            //public class EmailService : IIdentityMessageService
            //{
            //    public Task SendAsync(IdentityMessage message)
            //    {
            //        // настройка логина, пароля отправителя
            //        var from = "[email protected]";
            //        var pass = "3323876may1993";

            //        // адрес и порт smtp-сервера, с которого мы и будем отправлять письмо
            //        SmtpClient client = new SmtpClient("smtp.mail.ru", 25);

            //        client.DeliveryMethod = SmtpDeliveryMethod.Network;
            //        client.UseDefaultCredentials = false;
            //        client.Credentials = new System.Net.NetworkCredential(from, pass);
            //        client.EnableSsl = true;

            //        // создаем письмо: message.Destination - адрес получателя
            //        var mail = new MailMessage(from, message.Destination);
            //        mail.Subject = message.Subject;
            //        mail.Body = message.Body;
            //        mail.IsBodyHtml = true;

            //        return client.SendMailAsync(mail);
            //    }
            //}
        }
开发者ID:krasnovandr,项目名称:Personal,代码行数:71,代码来源:Startup.Auth.cs

示例10: ConfigureAuth

        // Дополнительные сведения о настройке проверки подлинности см. по адресу: http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Настройка контекста базы данных, диспетчера пользователей и диспетчера входа для использования одного экземпляра на запрос
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

            // Включение использования файла cookie, в котором приложение может хранить информацию для пользователя, выполнившего вход,
            // и использование файла cookie для временного хранения информации о входах пользователя с помощью стороннего поставщика входа
            // Настройка файла cookie для входа
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Позволяет приложению проверять метку безопасности при входе пользователя.
                    // Эта функция безопасности используется, когда вы меняете пароль или добавляете внешнее имя входа в свою учетную запись.
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });

            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Позволяет приложению временно хранить информацию о пользователе, пока проверяется второй фактор двухфакторной проверки подлинности.
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Позволяет приложению запомнить второй фактор проверки имени входа. Например, это может быть телефон или почта.
            // Если выбрать этот параметр, то на устройстве, с помощью которого вы входите, будет сохранен второй шаг проверки при входе.
            // Точно так же действует параметр RememberMe при входе.
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

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

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

            app.UseFacebookAuthentication(
               appId: AppFacebookId,
               appSecret: AppFacebookSecret
            );

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = AppGoogleId,
                ClientSecret = AppGoogleSecret
            });

            app.UseVkontakteAuthentication(new VkAuthenticationOptions()
            {
                AppId = AppVkId,
                AppSecret = AppVkSecret,
                Scope = AppVkScope,
                Caption = "Вконтакте"
            });
        }
开发者ID:MytanTTeR,项目名称:YourWorks,代码行数:63,代码来源:Startup.Auth.cs

示例11: ConfigureAuth


//.........这里部分代码省略.........
            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<AuthenticationUserManager, UserAuthDb>(
                        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: "");

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

            //app.UseGoogleAuthentication();

            var options = new VkAuthenticationOptions
            {
                AppId = "5370269",
                AppSecret = "RMw7P2WLOypLGgzc7fzi",
                Scope = "262144",
                Provider = new VkAuthenticationProvider()
                {
                    OnAuthenticated = (context) =>
                    {
                        // Only some of the basic details from facebook
                        // like id, username, email etc are added as claims.
                        // But you can retrieve any other details from this
                        // raw Json object from facebook and add it as claims here.
                        // Subsequently adding a claim here will also send this claim
                        // as part of the cookie set on the browser so you can retrieve
                        // on every successive request.
                        var userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
                        var userId = HttpContext.Current.User.Identity.GetUserId();
                        var user = userManager.FindByName(context.UserName);
                        if (user == null)
                        {
                            user = new ApplicationUser {
                                UserName = context.UserName,
                                Email = string.IsNullOrEmpty(context.Email)
                                    ? Guid.NewGuid() + "@diysoccer.ru"
                                    : context.Email
                            };
                            var result = userManager.Create(user, "0O9i8u#");
                            if (result.Succeeded)
                            {
                                var code = userManager.GenerateEmailConfirmationToken(user.Id);
                                var confirmation = userManager.ConfirmEmail(user.Id, code);
                                if (confirmation.Succeeded)
                                {
                                    context.Identity.AddClaim(new Claim("VkAccessToken", context.AccessToken));
                                    context.Identity.AddClaim(new Claim("VkUserId", context.Id));
                                }
                            }
                        }
                        else
                        {
                            if (!user.EmailConfirmed)
                            {
                                var code = userManager.GenerateEmailConfirmationToken(user.Id);
                                var confirmation = userManager.ConfirmEmail(userId, code);
                                if (confirmation.Succeeded)
                                {
                                    context.Identity.AddClaim(new Claim("VkAccessToken", context.AccessToken));
                                    context.Identity.AddClaim(new Claim("VkUserId", context.Id));
                                }
                            }
                            context.Identity.AddClaim(new Claim("VkAccessToken", context.AccessToken));
                            context.Identity.AddClaim(new Claim("VkUserId", context.Id));
                        }

                        return Task.FromResult(0);
                    }
                }
            };

            app.UseVkontakteAuthentication(options);
        }
开发者ID:AlexeyKryachko,项目名称:leagues,代码行数:101,代码来源:Startup.Auth.cs

示例12: EnableVk

 private void EnableVk(IAppBuilder app)
 {
     var options = new VkAuthenticationOptions
     {
         AppId = _vkId,
         AppSecret = _vkSecret,
         Scope = _vkScope
     };
     app.UseVkontakteAuthentication(options);
 }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:10,代码来源:Startup.Auth.cs

示例13: 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);
            
            app.UseTwitterAuthentication(new TwitterAuthenticationOptions
            {
                ConsumerKey = "WUOz1dJWadM5NSUmgMrcPgiIa",
                ConsumerSecret = "9tO77dgpGcQuve4MDf0ZTKuHY3TVw8QLpjRTCTxDXh9vJpQXyc",
                Provider = new TwitterAuthenticationProvider
                {
                    OnAuthenticated = async context =>
                    {
                        context.Identity.AddClaim(new Claim("AccessToken", context.AccessToken));
                        context.Identity.AddClaim(new Claim("AccessTokenSecret", context.AccessTokenSecret));
                        context.Identity.AddClaim(new Claim("ConsumerKey", "WUOz1dJWadM5NSUmgMrcPgiIa"));
                        context.Identity.AddClaim(new Claim("ConsumerSecret", "9tO77dgpGcQuve4MDf0ZTKuHY3TVw8QLpjRTCTxDXh9vJpQXyc"));
                    }
                }
            });

            var fb = new FacebookAuthenticationOptions();
            fb.Scope.Add("email");
            fb.Scope.Add("user_birthday");
            fb.Scope.Add("user_location");
            fb.Scope.Add("user_photos");
            fb.AppId = "609844869113324";
            fb.AppSecret = "399f367e79f11226d1522c00c72a6c6d";
            fb.Provider = new FacebookAuthenticationProvider
            {
                OnAuthenticated = async context =>
                {
                    // Get accesstoken from Facebook and store it in the database and
                    // user Facebook C# SDK to get more information about the user
                    context.Identity.AddClaim(new Claim("AccessToken", context.AccessToken));
                    context.Identity.AddClaim(new Claim("AccessTokenExpiresIn", context.ExpiresIn.ToString()));
                }
            };
            fb.SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie;
            app.UseFacebookAuthentication(fb);

            app.UseGoogleAuthentication(
                new GoogleOAuth2AuthenticationOptions
                {
                    ClientId = "847308079087-bl2m5iev3iibsp9pfoulodosek33rtrl.apps.googleusercontent.com",
                    ClientSecret = "oHy-Vd8TS48P4Ybz_Gsp_y2h",
                    Provider = new GoogleOAuth2AuthenticationProvider
                    {
                        OnAuthenticated = async context =>
                        {
                            context.Identity.AddClaim(new Claim("AccessToken",context.AccessToken));
                            context.Identity.AddClaim(new Claim("AccessTokenExpiresIn", context.ExpiresIn.ToString()));
                        }
                    }
                });

#if DEBUG
            app.UseVkontakteAuthentication(
                appId: "4555819",
                appSecret: "hWvAhsHs1PhtGUyXblkV",
                scope: "audio,email, offline");
#else
            app.UseVkontakteAuthentication(
                appId: "4469725",
                appSecret: "1vUUwTGWEIp3bSLqDHuw",
                scope: "audio,email, offline");
#endif
        }
开发者ID:IhorSyerkov,项目名称:Azimuth,代码行数:75,代码来源:Startup.Auth.cs

示例14: ConfigureAuth

        // Дополнительные сведения о настройке проверки подлинности см. по адресу: http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Настройка контекста базы данных, диспетчера пользователей и диспетчера входа для использования одного экземпляра на запрос
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);

            // Включение использования файла cookie, в котором приложение может хранить информацию для пользователя, выполнившего вход,
            // и использование файла cookie для временного хранения информации о входах пользователя с помощью стороннего поставщика входа
            // Настройка файла cookie для входа
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Admin/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    // Позволяет приложению проверять метку безопасности при входе пользователя.
                    // Эта функция безопасности используется, когда вы меняете пароль или добавляете внешнее имя входа в свою учетную запись.
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(43000),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            // Позволяет приложению временно хранить информацию о пользователе, пока проверяется второй фактор двухфакторной проверки подлинности.
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));

            // Позволяет приложению запомнить второй фактор проверки имени входа. Например, это может быть телефон или почта.
            // Если выбрать этот параметр, то на устройстве, с помощью которого вы входите, будет сохранен второй шаг проверки при входе.
            // Точно так же действует параметр RememberMe при входе.
            app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);

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

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");
            app.UseYandexAuthentication(new YandexAuthenticationOptions()
            {
                CallbackPath = new PathString("/Home"),
                AppId = "f42a7b30448c4bd194d81d73ff228487",
                AppSecret = "9fe1f07ed8e44d47ac1a32577441168c"

            });

            app.UseFacebookAuthentication(
               appId: "877595882288063",
               appSecret: "53468735ef2f58a288868563de6f3f73");

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = "122827496798-qvhc2qikb2goj7pcva8mr81uc1fdh7l2.apps.googleusercontent.com",
                ClientSecret = "__A4RotNrJzpR7Xqfhkpd4zt"
            });
            //app.UseYahooAuthentication(
            //    consumerKey:"",
            //    consumerSecret: ""
            //);
            app.UseVkontakteAuthentication(
                clientId:"3678446",
                clientSecret:"21joIdkUW8GR86wnIClz"
            );
        }
开发者ID:crew1248,项目名称:web_store,代码行数:68,代码来源:Startup.Auth.cs

示例15: 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 role manager to use a single instance per request
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.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: "");

            app.UseFacebookAuthentication(
                appId: "192210411114861",
                appSecret: "7689503cb06dbe070034155f670b239b");

            app.UseGoogleAuthentication(
                clientId: "574750221498-79vev75cvaph2g3pquj2q67kmi5gh3q9.apps.googleusercontent.com",
                clientSecret: "Z-o7Z_BowZsv2B5GaEK7thW3");

            //{
            //	appId:"5139849",
            //	appSecret:"UmrnIJ8U60ooEYPBfBzN",
            //	scope:"sss"
            //}
            var vkauthOption = new VkAuthenticationOptions()
            {
                AppId = "5139849",
                AppSecret = "UmrnIJ8U60ooEYPBfBzN",
                Scope = "offline,friends"
            };

            app.UseVkontakteAuthentication(vkauthOption);
        }
开发者ID:JrPD,项目名称:OplineShop,代码行数:66,代码来源:Startup.Auth.cs


注:本文中的IAppBuilder.UseVkontakteAuthentication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。