本文整理匯總了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());
}