Vaadin 7.5.6、Vaadins Spring 1.0.0、Vaadin4Spring Managed Security Extension 0.0.7-SNAPSHOT、および Tomcat8 を使用しています。
現在、AuthenticationManagerConfigurerインターフェイスを実装する構成クラスを取得しました。
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.vaadin.spring.security.annotation.EnableVaadinManagedSecurity;
import org.vaadin.spring.security.config.AuthenticationManagerConfigurer;
import com.vaadin.server.CustomizedSystemMessages;
import com.vaadin.server.SystemMessages;
import com.vaadin.server.SystemMessagesInfo;
import com.vaadin.server.SystemMessagesProvider;
import de.blume2000.kiss.hibernate.dto.User;
import de.blume2000.kiss.hibernate.services.UserService;
import de.blume2000.kiss.utils.EncryptionUtil;
@Configuration
@EnableVaadinManagedSecurity
public class SecurityConfiguration implements AuthenticationManagerConfigurer
{
@Autowired
UserService userService;
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception
{
List<User> users = userService.findAll();
if (users == null)
return;
for (User user : users)
{
String encryptedPassword = EncryptionUtil.decryptPassword(user.getPassword(), user.getSalt());
auth.inMemoryAuthentication().withUser(user.getUsername()).password(encryptedPassword).roles(user.getRole());
}
}
/**
* Provide custom system messages to make sure the application is reloaded when the session expires.
*/
@SuppressWarnings("serial")
@Bean
SystemMessagesProvider systemMessagesProvider()
{
return new SystemMessagesProvider()
{
@Override
public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo)
{
CustomizedSystemMessages systemMessages = new CustomizedSystemMessages();
systemMessages.setSessionExpiredNotificationEnabled(false);
return systemMessages;
}
};
}
}
ユーザーがログインした場合、ユーザー アカウント設定を編集するオプションが表示されます。これにより、データベース内のユーザー オブジェクトが変更されます (ログイン用のユーザー名など)。彼がログアウトした場合、アプリケーションにユーザーリストをリロードさせて、ユーザーが新しいユーザー名を使用できるようにします。これはどのように可能ですか?
よろしくシンチラー