0

私は春のセキュリティを使用しています。ユーザーのログイン時に複数のページに表示する必要がある変数を含まないユーザー オブジェクトがあります。ドメインは次のようになります。

class User {
    String username
    String password
    boolean enabled
    boolean accountExpired
    boolean accountLocked
    boolean passwordExpired
    Integer securityQuestion
    String securityAnswer

}

class Profile {
   User user
   String displayMe  //this is actually a calculated transient string based on some other info
}

Profile と User は別のクラスです。一部のgspsで使用するために、セッションにprofile.displayMeを保存する必要があります。ドメインモデルにはいくつかのプロファイルタイプがあり、それらをすべて巨大なユーザードメインに結合するのは面倒だったので、1 つの大きなユーザードメインはありません。User.displayMe を作成するためにドメインを結合することはできません。

springsecurity のどこに profile.displayMe をセッションに保存しますか? 私はまだ springsecurity に精通していないので、「LoginController.groovy (springsecurity のデフォルトのログイン コントローラー) の認証メソッド」など、特定のヘルプが必要になります。

4

1 に答える 1