当前位置: 首页>>代码示例>>Java>>正文


Java UserImpl类代码示例

本文整理汇总了Java中org.jboss.errai.security.shared.api.identity.UserImpl的典型用法代码示例。如果您正苦于以下问题:Java UserImpl类的具体用法?Java UserImpl怎么用?Java UserImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserImpl类属于org.jboss.errai.security.shared.api.identity包,在下文中一共展示了UserImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIndependentSessionInvalidated

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Test
public void testIndependentSessionInvalidated() throws Exception {

    SessionProvider sessionProvider = new SessionProvider(httpSession,
                                                          1);

    when(authenticationService.getUser()).thenReturn(new UserImpl("testUser"));
    when(request.getSession(anyBoolean())).then(new Answer<HttpSession>() {
        @Override
        public HttpSession answer(InvocationOnMock invocationOnMock) throws Throwable {
            return sessionProvider.provideSession();
        }
    });

    final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();
    filter.authenticationService = authenticationService;
    filter.doFilter(request,
                    response,
                    chain);

    verify(httpSession,
           times(1)).invalidate();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:24,代码来源:BasicAuthSecurityFilterTest.java

示例2: testExistingSessionNotInvalidated

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Test
public void testExistingSessionNotInvalidated() throws Exception {

    SessionProvider sessionProvider = new SessionProvider(httpSession);

    when(authenticationService.getUser()).thenReturn(new UserImpl("testUser"));
    when(request.getSession(anyBoolean())).then(new Answer<HttpSession>() {
        @Override
        public HttpSession answer(InvocationOnMock invocationOnMock) throws Throwable {
            return sessionProvider.provideSession();
        }
    });

    final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();
    filter.authenticationService = authenticationService;
    filter.doFilter(request,
                    response,
                    chain);

    verify(httpSession,
           never()).invalidate();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:BasicAuthSecurityFilterTest.java

示例3: executeLogin

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
private User executeLogin(final String username,
                          final String password) throws LoginException {
    final LoginContext loginContext = createLoginContext(username,
                                                         password);
    loginContext.login();
    List<String> principals = loadEntitiesFromSubjectAndAdapters(username,
                                                                 loginContext.getSubject(),
                                                                 new String[]{rolePrincipleName});
    Collection<Role> roles = getRoles(principals);
    Collection<org.jboss.errai.security.shared.api.Group> groups = getGroups(principals);
    UserImpl user = new UserImpl(username,
                                 roles,
                                 groups);
    userOnThisThread.set(user);
    return user;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:JAASAuthenticationService.java

示例4: sessionInfo

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
private SessionInfo sessionInfo(final WatchContext context) {
    final String sessionId;
    final String user;
    if (context.getSessionId() == null) {
        sessionId = "<system>";
    } else {
        sessionId = context.getSessionId();
    }
    if (context.getUser() == null) {
        user = "<system>";
    } else {
        user = context.getUser();
    }

    return new SessionInfoImpl(sessionId,
                               new UserImpl(user));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:IOWatchServiceExecutorImpl.java

示例5: reloadEditorOnUpdateFromDifferentUser

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Test
public void reloadEditorOnUpdateFromDifferentUser() {
    lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,
                                                           "",
                                                           new SessionInfoImpl(user)));

    assertEquals(0,
                 reloads);

    lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,
                                                           "",
                                                           new SessionInfoImpl(new UserImpl("differentUser"))));

    assertEquals(1,
                 reloads);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:LockManagerTest.java

示例6: gwtSetUp

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Override
protected void gwtSetUp() throws Exception {
    MarshallerFramework.initializeDefaultSessionProvider();

    // because UberFire uses @Inject User, the only way we can set the current user is by putting this
    // cookie in place before the GWT modules get bootstrapped (so before super.gwtSetUp())
    Collection<? extends Role> roles = Arrays.asList(new RoleImpl("admin"));
    admin = new UserImpl("admin",
                         roles);
    Cookies.setCookie(UserCookieEncoder.USER_COOKIE_NAME,
                      UserCookieEncoder.toCookieValue(admin));

    super.gwtSetUp();
    placeManager = IOC.getBeanManager().lookupBean(PlaceManager.class).getInstance();
    securityContext = IOC.getBeanManager().lookupBean(SecurityContext.class).getInstance();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:MenuAuthorizationTest.java

示例7: setup

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Before
public void setup() {

    socialUserServiceAPICaller = new CallerMock<SocialUserServiceAPI>( socialUserServiceAPI );

    socialUserRepositoryAPICaller = new CallerMock<SocialUserRepositoryAPI>( socialUserRepositoryAPI );

    presenter.socialUserService = socialUserServiceAPICaller;
    presenter.socialUserRepositoryAPI = socialUserRepositoryAPICaller;
    presenter.selectedEvent = selectEvent;

    presenter.users = new HashMap<String, SocialUser>();
    presenter.loggedUser = new UserImpl( "dora" );

    dora = new SocialUser( "dora" );
    bento = new SocialUser( "bento" );

    presenter.users.put( "dora", dora );
    presenter.users.put( "bento", bento );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:21,代码来源:UserHomePageSidePresenterTest.java

示例8: getUser

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的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

示例9: doNotNullDemarshall

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Override
public SessionInfo doNotNullDemarshall(final EJValue ejValue,
                                       final MarshallingSession marshallingSession) {

    return new SessionInfoImpl(ejValue.isObject().get("id").isString().stringValue(),
                               new UserImpl(ejValue.isObject().get("identityId").isString().stringValue()));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:8,代码来源:SessionInfoMarshalller.java

示例10: createUser

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
public static User createUser(final String id,
                              final Set<Group> groups,
                              final Set<Role> roles,
                              final Map<String, String> properties) {
    if (id == null) {
        return null;
    }
    final Set<Group> _groups = groups != null ? new HashSet<Group>(groups) : new HashSet<Group>(0);
    final Set<Role> _roles = roles != null ? new HashSet<Role>(roles) : new HashSet<Role>(0);
    final Map<String, String> _properties = properties != null ? new HashMap<String, String>(properties) : new HashMap<String, String>(0);
    return new UserImpl(id,
                        _roles,
                        _groups,
                        _properties);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:16,代码来源:SecurityManagementUtils.java

示例11: clone

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
public static User clone(final User user) {
    if (user == null) {
        return null;
    }
    final String id = user.getIdentifier();
    final Set<Group> groups = user.getGroups() != null ? new HashSet<Group>(user.getGroups()) : new HashSet<Group>(0);
    final Set<Role> roles = user.getRoles() != null ? new HashSet<Role>(user.getRoles()) : new HashSet<Role>(0);
    final Map<String, String> properties = user.getProperties() != null ? new HashMap<String, String>(user.getProperties()) : new HashMap<String, String>(0);
    return new UserImpl(id,
                        roles,
                        groups,
                        properties);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:SecurityManagementUtils.java

示例12: onAssignGroups

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
void onAssignGroups() {

        final User dummyUser = new UserImpl(user.getIdentifier(),
                                            userAssignedRolesExplorer.getValue(),
                                            userAssignedGroupsExplorer.getValue(),
                                            user.getProperties());

        if (isEditMode) {
            userAssignedGroupsEditor.edit(dummyUser);
        } else {
            userAssignedGroupsEditor.show(dummyUser);
        }
    }
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:UserEditor.java

示例13: onAssignRoles

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
void onAssignRoles() {

        final User dummyUser = new UserImpl(user.getIdentifier(),
                                            userAssignedRolesExplorer.getValue(),
                                            userAssignedGroupsExplorer.getValue(),
                                            user.getProperties());

        if (isEditMode) {
            userAssignedRolesEditor.edit(dummyUser);
        } else {
            userAssignedRolesEditor.show(dummyUser);
        }
    }
 
开发者ID:kiegroup,项目名称:appformer,代码行数:14,代码来源:UserEditor.java

示例14: getUser

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
private User getUser() {
    try {
        return authenticationService.getUser();
    } catch (final IllegalStateException ex) {
        return new UserImpl("system",
                            asList(new RoleImpl("admin")));
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:IOSecurityService.java

示例15: setup

import org.jboss.errai.security.shared.api.identity.UserImpl; //导入依赖的package包/类
@Before
public void setup() {
    setupRpcContext();

    User testUser = new UserImpl("testUser");
    when(sessionInfo.getIdentity()).thenReturn(testUser);
    when(queueSession.getAttribute(HttpSession.class,
                                   HttpSession.class.getName())).thenReturn(httpSession);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:VFSLockServiceTest.java


注:本文中的org.jboss.errai.security.shared.api.identity.UserImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。