Spring Security プラグインの SwitchUser 機能を構成しようとしていますが、成功していません。ほとんどの場合、それは単純で階層的なように見えますが、すべてのコードを配置して「切り替え」ボタンをクリックすると、切り替えを行わずにデフォルトのホーム URL にリダイレクトされます。
公式の Spring Security Core プラグイン サイトに既に存在するものよりも多くの情報を持っている人はいますか? 私はそれに関連するすべてのものをゴーグルして読んでいますが、元の情報は見つかりませんでした.ほとんどすべてがBeckwithとTalbottの元のドキュメントのコピーです.
以下は私のアプリのコードです:
Config.groovy
grails.plugins.springsecurity.useSwitchUserFilter = true
grails.plugins.springsecurity.interceptUrlMap = [
'/j_spring_security_switch_user': ['ROLE_SWITCH_USER', 'isFullyAuthenticated()'],
'/j_spring_security_exit_user': ['permitAll'],
]
InterceptUrlMap と controllerAnnotations (?) のどちらを使用する必要があるか、またはどちらを使用するかを決定する基準がわかりません。
.gsp コード:
<sec:ifLoggedIn>
Logged in as <sec:username/>
</sec:ifLoggedIn>
<sec:ifSwitched>
<a href='${request.contextPath}/j_spring_security_exit_user'>
Resume as <sec:switchedUserOriginalUsername/>
</a>
</sec:ifSwitched>
<sec:ifNotSwitched>
<sec:ifAllGranted roles='ROLE_SWITCH_USER'>
<form action='${request.contextPath}/j_spring_security_switch_user' method='POST'>
Switch to user: <input type='text' name='j_username'/><br/>
<input type='submit' value='Switch'/>
</form>
</sec:ifAllGranted>
</sec:ifNotSwitched>
関連する他のコードや設定については知りません。さらに情報が必要な場合はお知らせください。