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


Java SecurityManager类代码示例

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


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

示例1: loginUser

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * This method will authenticate a user agains the security manager
 * for the specified project.  Throws a LoginException if the user
 * cannot be authenticated, otherwise returns a UserInfoBean with information
 * about the user.
 *
 * @param userName
 * @param password
 * @return
 * @throws LoginException
 * @deprecated
 */
public UserInfoBean loginUser(String userName, String password)
        throws LoginException {

    UserInfoBean userInfo = new UserInfoBean();

    UserCredentials user = null;
    SecurityManager secManager = SecurityManager.getInstance(APP_NAME);
    try {
        if (secManager.authenticate(userName, password)) {
            user = secManager.authorization(userName);
        }
    } catch (AuthenticationException e) {
        throw new LoginException(e);
    }
    userInfo.setLoggedIn(true);
    userInfo.setUserName(userName);
    

    return userInfo;
}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:33,代码来源:CsmLoginService.java

示例2: login

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * This method will authenticate a user agains the security manager
 * for the specified project.  Throws a LoginException if the user
 * cannot be authenticated, otherwise returns a UserInfoBean with information
 * about the user.
 *
 * @param userName
 * @param password
 * @return
 * @throws LoginException
 */
public UserCredentials login(String userName, String password)
        throws LoginException {

   UserCredentials user = null;
    SecurityManager secManager = SecurityManager.getInstance(APP_NAME);
    try {
        if (secManager.authenticate(userName, password)) {
            user = secManager.authorization(userName);
        }
    } catch (AuthenticationException e) {
        throw new LoginException(e);
    }

    return user;
}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:27,代码来源:CsmLoginService.java

示例3: setUpSecurityManager

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
private void setUpSecurityManager() throws Exception {
    secManager = mock(SecurityManager.class);
    when(secManager.getAuthorizationManager()).thenReturn(authManager);
    when(secManager.doesUserExist(eq(USER_EXISTS))).thenReturn(Boolean.TRUE);
    when(secManager.doesUserExist(eq(USERNAME))).thenReturn(Boolean.TRUE);
    when(secManager.retrieveManagedStudyConfigurations(anyString(), anyCollectionOf(Study.class))).thenAnswer(new Answer<Set<StudyConfiguration>>() {

        @SuppressWarnings("unchecked")
        @Override
        public Set<StudyConfiguration> answer(InvocationOnMock invocation) throws Throwable {
            Set<StudyConfiguration> results = new HashSet<StudyConfiguration>();
            Collection<Study> studies = (Collection<Study>) invocation.getArguments()[1];
            if (CollectionUtils.isNotEmpty(studies)) {
                for (Study study : studies) {
                    results.add(study.getStudyConfiguration());
                }
            }
            return results;
        }
    });
    when(secManager.retrieveAuthorizedStudyElementsGroupsForInvestigator(anyString(), anySetOf(AuthorizedStudyElementsGroup.class)))
        .thenReturn(new HashSet<AuthorizedStudyElementsGroup>());
    when(secManager.getUnauthorizedGroups(any(StudyConfiguration.class))).thenReturn(new ArrayList<Group>());
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:25,代码来源:AbstractSecurityEnabledMockitoTest.java

示例4: prepareTest

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * Sets up the tests.
 */
@Before
public void prepareTest() throws Exception {
    super.setUp();
    action = new EditAuthorizedGroupAction();
    action.setWorkspaceService(workspaceService);

    Group group = new Group();
    group.setGroupName("Test Group");
    group.setGroupDesc("Description");

    authorizationManager = mock(AuthorizationManager.class);
    securityManager = mock(SecurityManager.class);
    when(securityManager.getUnauthorizedGroups(any(StudyConfiguration.class))).thenReturn(Arrays.asList(group));
    when(securityManager.getAuthorizationManager()).thenReturn(authorizationManager);
    action.setSecurityManager(securityManager);

    studyManagementService = mock(StudyManagementService.class);
    when(studyManagementService.getRefreshedEntity(any(AbstractCaIntegrator2Object.class))).thenAnswer(new Answer<Object>() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Object arg = invocation.getArguments()[0];
            if (arg instanceof AnnotationFieldDescriptor) {
                AnnotationFieldDescriptor descriptor = (AnnotationFieldDescriptor) arg;
                AnnotationDefinition definition = new AnnotationDefinition();
                definition.setDataType(AnnotationTypeEnum.STRING);
                descriptor.setDefinition(definition);
                arg = descriptor;
            }
            return arg;
        }
    });
    action.setStudyManagementService(studyManagementService);
    action.clearErrorsAndMessages();
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:38,代码来源:EditAuthorizedGroupActionTest.java

示例5: getSecurityManager

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * @return the securityManager
 */
public SecurityManager getSecurityManager() {
    return securityManager;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:7,代码来源:RegistrationAction.java

示例6: setSecurityManager

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * @param securityManager the securityManager to set
 */
@Autowired
public void setSecurityManager(SecurityManager securityManager) {
    this.securityManager = securityManager;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:8,代码来源:RegistrationAction.java

示例7: setSecurityManager

import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
 * @param securityManager the securityManager to set
 */
public void setSecurityManager(SecurityManager securityManager) {
    this.securityManager = securityManager;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:7,代码来源:EditAuthorizedGroupAction.java


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