Exemplo n.º 1
0
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Configure the application for OAuth based flow
            PublicClientId            = "MxRblSync.Api";
            OAuthAuthorizationOptions = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath         = new PathString("/Authenticate"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                Provider = new ApiAuthorizationProvider(
                    _loginSessionRepository,
                    _authKeyRepository,
                    _userRepository,
                    _hashingService,
                    PublicClientId),
#if DEBUG
                AllowInsecureHttp = true
#else
                AllowInsecureHttp = false
#endif
            };

            // Enable the application to use bearer tokens to authenticate users
            app.UseOAuthAuthorizationServer(OAuthAuthorizationOptions);

            OAuthAuthenticationOptions = new OAuthBearerAuthenticationOptions
            {
                Provider = new ApiAuthenticationProvider(_authKeyRepository)
            };

            app.UseOAuthBearerAuthentication(OAuthAuthenticationOptions);
        }
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Configure the application for OAuth based flow
            PublicClientId = "MxRblSync.Api";
            OAuthAuthorizationOptions = new OAuthAuthorizationServerOptions
            {
                TokenEndpointPath = new PathString("/Authenticate"),
                AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
                Provider = new ApiAuthorizationProvider(
                    _loginSessionRepository,
                    _authKeyRepository,
                    _userRepository,
                    _hashingService,
                    PublicClientId),
            #if DEBUG
                AllowInsecureHttp = true
            #else
                AllowInsecureHttp = false
            #endif
            };

            // Enable the application to use bearer tokens to authenticate users
            app.UseOAuthAuthorizationServer(OAuthAuthorizationOptions);

            OAuthAuthenticationOptions = new OAuthBearerAuthenticationOptions
            {
                Provider = new ApiAuthenticationProvider(_authKeyRepository)
            };

            app.UseOAuthBearerAuthentication(OAuthAuthenticationOptions);
        }