Пример #1
0
        public static IAppBuilder UseGoogleOAuth2BearerAuthentication(
            this IAppBuilder app,
            string clientId,
            string clientSecret,
            IGoogleOAuth2AuthenticationProvider googleProvider,
            IOAuthBearerAuthenticationProvider bearerProvider,
            ISecureDataFormat <AuthenticationTicket> _accessTokenFormat
            )
        {
            app.SetDefaultSignInAsAuthenticationType(AuthenticationTypes.GoogleBearer);

            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
            {
                AccessTokenFormat  = _accessTokenFormat,
                AuthenticationMode = AuthenticationMode.Active,
                AuthenticationType = AuthenticationTypes.GoogleBearer,
                Provider           = bearerProvider
            });

            app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions
            {
                ClientId     = clientId,
                ClientSecret = clientSecret,
                Provider     = googleProvider
            });

            return(app);
        }
Пример #2
0
 public GoogleOAuthOptions(IGoogleOAuth2AuthenticationProvider googleOAuth2AuthenticationProvider)
 {
     ClientId     = "xxxxxx";
     ClientSecret = "xxxxxx";
     Provider     = googleOAuth2AuthenticationProvider;
 }