none
Dos maneras de Inicio de Sesión (Clase Startup)

    Pregunta

  • Buen día soy nuevo respecto a la seguridad, mi problema es que se tienen dos paginas de Login cada una tiene su forma de Logearse ya que en una el Id es de tipo decimal y en la otra es de tipo string por lo que existen dos clases de UserManager y SignInManager, quisiera saber si hay manera de que estas dos convivan en la misma aplicación

    Este es una

    public void ConfigureAuth(IAppBuilder app) { // Configure the db context, user manager and signin manager to use a single instance per request app.CreatePerOwinContext<CustomServiceApplicationUserManager>(CustomServiceApplicationUserManager.Create); app.CreatePerOwinContext<CustomServiceApplicationSignInManager>(CustomServiceApplicationSignInManager.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("/AccountAdmin/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<CustomServiceApplicationUserManager, CustomServiceUser, decimal>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentityCallback: (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie), getUserIdCallback: ( id ) => id.GetUserId<decimal>()) } });

    }

    y este es la otra 

    public void ConfigureAuth( IAppBuilder app )
            {
                app.CreatePerOwinContext<CaseApplicationUserManager>(CaseApplicationUserManager.Create);
                app.CreatePerOwinContext<CaseApplicationSignInManager>(CaseApplicationSignInManager.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,
                    CookieName = "ia_session_" + Intercase.CaseFramework.App.Default.PARAM_APP_CODE,
                    LoginPath = new PathString("/Account/Login"),
                    SlidingExpiration = true,
                    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<CaseApplicationUserManager, CaseUser>(
                            validateInterval: TimeSpan.FromMinutes(60),
                            regenerateIdentity: ( manager, user ) => user.GenerateUserIdentityAsync(manager)),
                        OnApplyRedirect = ctx =>
                        {
                            if ( !IsAjaxRequest(ctx.Request) )
                            {
                                ctx.Response.Redirect(ctx.RedirectUri);
                            }
                        }
                    }
                });
            }
    De antemano muchas gracias 


    Cesar

    martes, 8 de mayo de 2018 15:33

Respuestas