本文整理汇总了Java中org.keycloak.storage.StorageId类的典型用法代码示例。如果您正苦于以下问题:Java StorageId类的具体用法?Java StorageId怎么用?Java StorageId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StorageId类属于org.keycloak.storage包,在下文中一共展示了StorageId类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserById
import org.keycloak.storage.StorageId; //导入依赖的package包/类
@Override
public UserModel getUserById(String id, RealmModel realm) {
logger.info("getUserById: " + id);
String persistenceId = StorageId.externalId(id);
UserEntity entity = em.find(UserEntity.class, persistenceId);
if (entity == null) {
logger.info("could not find user by id: " + id);
return null;
}
return new UserAdapter(session, realm, model, entity);
}
示例2: removeUser
import org.keycloak.storage.StorageId; //导入依赖的package包/类
@Override
public boolean removeUser(RealmModel realm, UserModel user) {
String persistenceId = StorageId.externalId(user.getId());
UserEntity entity = em.find(UserEntity.class, persistenceId);
if (entity == null) return false;
em.remove(entity);
return true;
}
示例3: getUserById
import org.keycloak.storage.StorageId; //导入依赖的package包/类
@Override
public UserModel getUserById(String id, RealmModel realm) {
logger.info("getUserById: " + id);
String persistenceId = StorageId.externalId(id);
UserEntity entity = em.find(UserEntity.class, persistenceId);
if (entity == null) {
logger.info("No fue posible encontrar el usuario por id: " + id);
return null;
}
return new UserAdapter(session, realm, model, entity);
}
示例4: getUserById
import org.keycloak.storage.StorageId; //导入依赖的package包/类
@Override
public UserModel getUserById(String id, RealmModel realm) {
StorageId storageId = new StorageId(id);
String username = storageId.getExternalId();
return getUserByUsername(username, realm);
}
示例5: UserAdapter
import org.keycloak.storage.StorageId; //导入依赖的package包/类
public UserAdapter(KeycloakSession session, RealmModel realm, ComponentModel model, UserEntity entity) {
super(session, realm, model);
this.entity = entity;
keycloakId = StorageId.keycloakId(model, entity.getId());
}