private OAuthAuthorizationServerOptions GetOptionsApi(IServiceSeguridad service) { var value = KeysConfiguration.KeyAccessTokenExpireMin; var result = new OAuthAuthorizationServerOptions() { //AllowInsecureHttp = KeysConfiguration.KeyApiUseHttp, TokenEndpointPath = new PathString(KeysConfiguration.KeyTokenUrl), AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(value), Provider = new AuthorizationServerProvider(service), RefreshTokenProvider = new RefreshTokenProvider() }; return(result); }
private void ConfigureOAuth(IAppBuilder app, IServiceSeguridad pSeguridad) { #region UseOAuthBearerAuthentication var authOptions = new OAuthBearerAuthenticationOptions() { AuthenticationType = "Bearer", AuthenticationMode = AuthenticationMode.Active }; var ApiOauthOptions = GetOptionsApi(pSeguridad); //var webOauthOptions = GetOptionsWeb(pSeguridad); app.UseOAuthAuthorizationServer(ApiOauthOptions); //app.UseOAuthAuthorizationServer(webOauthOptions); app.UseOAuthBearerAuthentication(authOptions); #endregion }
/// <summary> /// /// </summary> /// <param name="pSeguridad"></param> public AuthorizationServerProvider(IServiceSeguridad pSeguridad) { _seguridad = pSeguridad ?? throw new ArgumentNullException(nameof(pSeguridad)); }