本文整理汇总了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;
}
示例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;
}
示例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>());
}
示例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();
}
示例5: getSecurityManager
import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
* @return the securityManager
*/
public SecurityManager getSecurityManager() {
return securityManager;
}
示例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;
}
示例7: setSecurityManager
import gov.nih.nci.caintegrator.security.SecurityManager; //导入依赖的package包/类
/**
* @param securityManager the securityManager to set
*/
public void setSecurityManager(SecurityManager securityManager) {
this.securityManager = securityManager;
}