當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。