本文整理汇总了Java中org.jboss.errai.security.shared.api.identity.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于org.jboss.errai.security.shared.api.identity包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterInitialization
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@AfterInitialization
public void afterInitialization() {
authenticationServiceCaller.call(new RemoteCallback<User>() {
@Override
public void callback(User user) {
Label userLabel = new Label(
"User logged in: username=" + user.getIdentifier() + ", roles=" + user.getRoles());
RootPanel.get().add(userLabel);
SimplePanel panel = new SimplePanel();
Anchor logoutLink = new Anchor("Spring Security Logout URL", GWT.getHostPageBaseURL() + "logout");
panel.add(logoutLink);
RootPanel.get().add(panel);
initBtns();
}
}).getUser();
}
开发者ID:expansel,项目名称:errai-spring-boot-sample,代码行数:17,代码来源:App.java
示例2: executeConcurrentUpdateCommand
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
private void executeConcurrentUpdateCommand(final Path path,
final String sessionId,
final User identity) {
if (!onConcurrentUpdateCommand.isEmpty()) {
final OnConcurrentUpdateEvent event = new OnConcurrentUpdateEvent() {
@Override
public Path getPath() {
return path;
}
@Override
public String getId() {
return sessionId;
}
@Override
public User getIdentity() {
return identity;
}
};
for (final ParameterizedCommand<OnConcurrentUpdateEvent> command : onConcurrentUpdateCommand) {
command.execute(event);
}
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:ObservablePathImpl.java
示例3: executeConcurrentDeleteCommand
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
private void executeConcurrentDeleteCommand(final Path path,
final String sessionId,
final User identity) {
if (!onConcurrentDeleteCommand.isEmpty()) {
final OnConcurrentDelete event = new OnConcurrentDelete() {
@Override
public Path getPath() {
return path;
}
@Override
public String getId() {
return sessionId;
}
@Override
public User getIdentity() {
return identity;
}
};
for (final ParameterizedCommand<OnConcurrentDelete> command : onConcurrentDeleteCommand) {
command.execute(event);
}
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:ObservablePathImpl.java
示例4: testAddMenus
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testAddMenus() {
final String perspectiveId = "perspectiveId";
final String label = "perspectiveLabel";
final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();
when(authzManager.authorize(menus.getItems().get(0),
identity)).thenReturn(true);
presenter.addMenus(menus);
verify(authzManager,
never()).authorize(any(MenuItem.class),
any(User.class));
verify(presenter,
never()).addMenuItem(anyString(),
anyString(),
anyString(),
any(Command.class),
any(MenuPosition.class));
}
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:WorkbenchMegaMenuStandalonePresenterTest.java
示例5: changePassword
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Override
public void changePassword(String username,
String newPassword) throws SecurityManagementException {
checkNotNull("username",
username);
MemoryUserDatabase userDatabase = getDatabase();
try {
org.apache.catalina.User user = getUser(userDatabase,
username);
user.setPassword(newPassword);
saveDatabase(userDatabase);
} finally {
closeDatabase(userDatabase);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:TomcatUserManager.java
示例6: CopyServiceImpl
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Inject
public CopyServiceImpl(@Named("ioStrategy") IOService ioService,
User identity,
SessionInfo sessionInfo,
Instance<CopyHelper> helpers,
Event<ResourceCopiedEvent> resourceCopiedEvent,
Instance<CopyRestrictor> copyRestrictorBeans,
PathNamingService pathNamingService) {
this.ioService = ioService;
this.identity = identity;
this.sessionInfo = sessionInfo;
this.helpers = helpers;
this.resourceCopiedEvent = resourceCopiedEvent;
this.copyRestrictorBeans = copyRestrictorBeans;
this.pathNamingService = pathNamingService;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:CopyServiceImpl.java
示例7: testSearchAllThirdPage
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testSearchAllThirdPage() {
AbstractEntityManager.SearchRequest request = buildSearchRequestMock("",
3,
5);
AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);
assertNotNull(response);
List<User> users = response.getResults();
int total = response.getTotal();
boolean hasNextPage = response.hasNextPage();
assertEquals(total,
usersCount);
assertTrue(hasNextPage);
assertEquals(users.size(),
5);
User user10 = users.get(0);
assertUser(user10,
USERNAME + 10);
User user14 = users.get(4);
assertUser(user14,
USERNAME + 14);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:KeyCloakUserManagerTest.java
示例8: create
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Override
public User create(User entity) throws SecurityManagementException {
checkNotNull("entity",
entity);
MemoryUserDatabase userDatabase = getDatabase();
try {
String username = entity.getIdentifier();
String fullName = entity.getProperty(ATTRIBUTE_USER_FULLNAME);
userDatabase.createUser(username,
"",
fullName != null ? fullName : "");
saveDatabase(userDatabase);
return entity;
} finally {
closeDatabase(userDatabase);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:TomcatUserManager.java
示例9: checkPermission
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Override
public AuthorizationResult checkPermission(Permission permission,
User user,
VotingStrategy votingStrategy) {
if (authorizationPolicy == null || permission == null) {
return ACCESS_ABSTAIN;
}
AuthorizationResult result = cache.get(user,
permission);
if (result == null) {
result = _checkPermission(permission,
user,
votingStrategy == null ? defaultVotingStrategy : votingStrategy);
cache.put(user,
permission,
result);
}
return result;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:21,代码来源:DefaultPermissionManager.java
示例10: _checkPermission
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
protected AuthorizationResult _checkPermission(Permission permission,
User user,
VotingStrategy votingStrategy) {
if (VotingStrategy.PRIORITY.equals(votingStrategy)) {
PermissionCollection userPermissions = resolvePermissions(user,
VotingStrategy.PRIORITY);
return _checkPermission(permission,
userPermissions);
} else {
List<AuthorizationResult> permList = _checkRoleAndGroupPermissions(permission,
user);
VotingAlgorithm votingAlgorithm = votingAlgorithmMap.get(votingStrategy);
return votingAlgorithm.vote(permList);
}
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:DefaultPermissionManager.java
示例11: mergeRolePermissions
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
/**
* Merge the target collection with the permissions assigned to the given user's roles
*/
private PermissionCollection mergeRolePermissions(User user,
PermissionCollection target,
int[] lastPriority) {
PermissionCollection result = target;
if (user.getRoles() != null) {
for (Role role : user.getRoles()) {
PermissionCollection collection = authorizationPolicy.getPermissions(role);
int priority = authorizationPolicy.getPriority(role);
int comparator = resolve(priority,
lastPriority[0]);
result = result.merge(collection,
comparator);
if (priority > lastPriority[0]) {
lastPriority[0] = priority;
}
}
}
return result;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:DefaultPermissionManager.java
示例12: mergeGroupPermissions
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
/**
* Merge the target collection with the permissions assigned to the given user's groups
*/
private PermissionCollection mergeGroupPermissions(User user,
PermissionCollection target,
int[] lastPriority) {
PermissionCollection result = target;
if (user.getGroups() != null) {
for (Group group : user.getGroups()) {
PermissionCollection collection = authorizationPolicy.getPermissions(group);
int priority = authorizationPolicy.getPriority(group);
int comparator = resolve(priority,
lastPriority[0]);
result = result.merge(collection,
comparator);
if (priority > lastPriority[0]) {
lastPriority[0] = priority;
}
}
}
return result;
}
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:DefaultPermissionManager.java
示例13: testCheckPermission1
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testCheckPermission1() {
User user = createUserMock("viewAll");
assertEquals(permissionManager.checkPermission(viewAll,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(view1,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(view2,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(noView1,
user),
ACCESS_DENIED);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:PermissionManagerTest.java
示例14: testCheckPermission2
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testCheckPermission2() {
User user = createUserMock("viewAll",
"onlyView1");
assertEquals(permissionManager.checkPermission(viewAll,
user),
ACCESS_DENIED);
assertEquals(permissionManager.checkPermission(view1,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(view2,
user),
ACCESS_DENIED);
assertEquals(permissionManager.checkPermission(noView1,
user),
ACCESS_DENIED);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:PermissionManagerTest.java
示例15: testCheckPermission4
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testCheckPermission4() {
User user = createUserMock("viewAll",
"noView1");
assertEquals(permissionManager.checkPermission(viewAll,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(view1,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(view2,
user),
ACCESS_GRANTED);
assertEquals(permissionManager.checkPermission(noView1,
user),
ACCESS_DENIED);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:PermissionManagerTest.java
示例16: testConsensusVoting
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testConsensusVoting() {
permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()
.role("role1").permission("resource.read",
true)
.role("role2").permission("resource.read",
false)
.role("role3").permission("resource.read",
true)
.build());
User user = createUserMock("role1",
"role2",
"role3");
assertEquals(permissionManager.checkPermission(viewAll,
user,
VotingStrategy.CONSENSUS),
ACCESS_DENIED);
user = createUserMock("role1",
"role3");
assertEquals(permissionManager.checkPermission(viewAll,
user,
VotingStrategy.CONSENSUS),
ACCESS_GRANTED);
}
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:PermissionManagerTest.java
示例17: testVotingAffirmative
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testVotingAffirmative() throws Exception {
User user1 = createUserMock("admin",
"manager");
permissionManager.setDefaultVotingStrategy(VotingStrategy.AFFIRMATIVE);
assertTrue(authorizationManager.authorize(perspective1,
user1));
authorizationManager.check(perspective1,
user1)
.granted(onGranted)
.denied(onDenied);
verify(onDenied,
never()).execute();
verify(onGranted).execute();
}
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:AuthorizationManagerTest.java
示例18: testSingleRoleHome
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Test
public void testSingleRoleHome() {
User userMock = createUserMock("admin");
String home = authorizationPolicy.getHomePerspective(userMock);
assertEquals(home,
"A");
userMock = createUserMock("manager");
home = authorizationPolicy.getHomePerspective(userMock);
assertEquals(home,
"M");
userMock = createUserMock("user");
home = authorizationPolicy.getHomePerspective(userMock);
assertEquals(home,
"U");
}
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:HomePerspectiveTest.java
示例19: login
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
@Override
public User login(String username, String password) {
if (isLoggedIn()) {
return getUser();
}
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
Authentication auth = authenticationManager.authenticate(token);
return getUser(auth);
}
开发者ID:expansel,项目名称:errai-spring-server,代码行数:11,代码来源:SpringSecurityAuthenticationService.java
示例20: getUser
import org.jboss.errai.security.shared.api.identity.User; //导入依赖的package包/类
private User getUser(Authentication auth) {
Collection<? extends GrantedAuthority> authorities = auth.getAuthorities();
ArrayList<RoleImpl> erraiRoles = new ArrayList<RoleImpl>(authorities.size());
for (GrantedAuthority grantedAuthority : authorities) {
erraiRoles.add(new RoleImpl(grantedAuthority.getAuthority().replace("ROLE_", "")));
}
User user = new UserImpl(auth.getName(), erraiRoles);
return user;
}
开发者ID:expansel,项目名称:errai-spring-server,代码行数:10,代码来源:SpringSecurityAuthenticationService.java
注:本文中的org.jboss.errai.security.shared.api.identity.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论