Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
另一个控制器中的Grails Spring安全登录表单_Spring_Security_Grails_View_Controller - Fatal编程技术网

另一个控制器中的Grails Spring安全登录表单

另一个控制器中的Grails Spring安全登录表单,spring,security,grails,view,controller,Spring,Security,Grails,View,Controller,我想将Grails Spring安全插件生成的登录视图的登录表单放在layouts/main.gsp的主布局中。我只是复制了它,但它不工作,因为原因,现在没有控制器可以将表单数据传递给。表单代码如下所示: <form action='${postUrl}' method='POST' id='loginForm' class='cssform' autocomplete='off'> <p> <label for='username'&g

我想将Grails Spring安全插件生成的登录视图的登录表单放在layouts/main.gsp的主布局中。我只是复制了它,但它不工作,因为原因,现在没有控制器可以将表单数据传递给。表单代码如下所示:

<form action='${postUrl}' method='POST' id='loginForm' class='cssform' autocomplete='off'>
      <p>
        <label for='username'><g:message code="springSecurity.login.username.label"/>:</label>
        <input type='text' class='text_' name='j_username' id='username'/>
      </p>
      <p>
        <label for='password'><g:message code="springSecurity.login.password.label"/>:</label>
        <input type='password' class='text_' name='j_password' id='password'/>
      </p>
      <p id="remember_me_holder">
        <input type='checkbox' class='chk' name='${rememberMeParameter}' id='remember_me' <g:if test='${hasCookie}'>checked='checked'</g:if>/>
        <label for='remember_me'><g:message code="springSecurity.login.remember.me.label"/></label>
      </p>
      <p><input type='submit' id="submit" value='${message(code: "springSecurity.login.button")}'/></p>
    </form>


:

:

我应该如何更改此代码,以便将表单代码发送到登录验证操作


谢谢。

据我所知,你的问题是如何使用表单操作
postUrl
应该与config中的
grails.plugins.springsecurity.apf.filterProcessURL
属性相同,默认情况下它是
/j\u spring\u security\u check

如果未更改此值,则可以使用
/j\u spring\u security\u check
而不是
${postrl}

SpringSecurty插件有专门的过滤器来处理这个URL,并授权用户。接下来的步骤取决于配置,但如果我没记错的话,默认情况下它会将用户重定向到
/


请参见

中的配置选项我的问题是,我只想在main.gsp中使用此表单,并在登录控制器中使用auth方法登录。我如何告诉他使用登录控制器的auth方法?我只想在另一个页面上登录,但现在在登录控制器的auth视图上。我已将表单中的${postrl}更改为/j_spring_security_check,它在我单击login后将我重定向到该URL,但什么也没有发生。必须由spring安全插件而不是登录控制器来处理该提示。您对控制器有什么期望?重定向后会发生什么?是我的错。我只是没有从上面理解你的答案。很抱歉现在它工作了D