visural-wicket庫的安全特性(完全公開 - 這是我的開源項目)可能允許您尋找的集成。
本博客文章解釋的基本機制 -
http://www.richardnichols.net/2011/09/securing-wicket-with-visural-wicket/
您可以通過使用他們的UserService與谷歌的安全集成到返回IClient包裝的谷歌用戶 -
public class GoogleUser implements IClient<String> {
private final User user;
private final boolean admin;
public GoogleUser(User user, boolean admin) {
this.user = user;
}
public String getId() {
return user.getUserId();
}
public User getUser() {
return user;
}
public boolean isAdmin() {
return admin;
}
}
public class MyApp extends Application {
public void init() {
// ...
getSecuritySettings().setAuthorizationStrategy(new com.visural.wicket.security.AuthorizationStrategy(new IClientProvider() {
public IClient getCurrentClient() {
UserService s = UserServiceFactory.getUserService();
return new GoogleUser(s.getCurrentUser(), s.isUserAdmin());
}
}));
// ...
}
}
然後,您可以在您的頁面或組件中實施安全性 -
public class MyPage extends WebPage implements ISecureRenderInstance {
// ...
public IPrivilege getRenderPrivilege() {
return new IPrivilege<GoogleUser>() {
public boolean isGrantedToClient(GoogleUser client) {
return client != null && client.isAdmin()
}
};
// instead of returning a anonymous class like this, you could also
// package up common privileges into a singleton instance,
// e.g. return Privilege.ADMIN;
}
}