After authentication in Spring Security, Grails 3 redirects me to auth.html

I'm implementing a login form like this:

<form action="${postUrl ?: '/login/auth'}" method="POST" id="loginForm" class="cssform" autocomplete="off">
   <p>Por favor ingrese sus credenciales:</p>
   <div class="form-group"  style="color: #2C3E50  ">
      <input type="text" name="${usernameParameter ?: 'username'}" id="username"  class="form-control input-lg" placeholder="Usuario" required="">
   </div>
   <div class="form-group"  style="color: #2C3E50">
      <input type="password" name="${passwordParameter ?: 'password'}" id="password" class="form-control input-lg" placeholder="Contraseña" required="">
   </div>
   <p id="remember_me_holder">
      <input type="checkbox" class="i-checks" name="${rememberMeParameter ?: 'remember-me'}" id="remember_me">
      <label>  Recuérdame</label>
   </p>
   <div class="btn-h">
      <button type="submit" class="btn btn-azul btn-lg block full-width m-b" id="submit" value='${message(code: 'springSecurity.login.button')}' title="Ingresar al sistema SIIDE-DGAPA">
         <i class="fa fa-sign-in"> </i>&nbsp; Iniciar sesión
      </button>
   </div>
</form>

Authentication works fine, but after logging in, redirects me to auth.html page, I want sent to index.gsp

Upvotes: 2

Views: 482

Answers (2)

Evgeny Smirnov
Evgeny Smirnov

Reputation: 3016

You can change this url:

application.yml:

grails:
  plugin:
    springsecurity:
      successHandler:
        defaultTargetUrl: "/pathToRedirectAfterLogin"
        alwaysUseDefault: true

Grails Spring Security plugin is very powerful. There are a huge number of different settings. Read docs: http://grails-plugins.github.io/grails-spring-security-core/

Upvotes: 1

Trainee
Trainee

Reputation: 57

From your question, I suspect you have a bit confused with how spring security works.

Please check out with this tutorial Spring Security Core Tutorial

This tutorial is quite useful

Hope it helps, cheers.

Upvotes: 0

Related Questions