示例#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);
        }
 /// <summary>
 /// Creates a context token provider that wraps a user provided token provider.
 /// </summary>
 /// <param name="inner">The inner token provider</param>
 public ContextTokenProvider(IOAuthBearerAuthenticationProvider inner = null)
 {
     _inner = inner;
 }
 /// <summary>
 /// Creates a context token provider that wraps a user provided token provider.
 /// </summary>
 /// <param name="inner">The inner token provider</param>
 public ContextTokenProvider(IOAuthBearerAuthenticationProvider inner = null)
 {
     _inner = inner;
 }