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


Java CSException类代码示例

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


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

示例1: getRoles

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * This method returns Vactor of all the role objects defined for the
 * application from the database
 * 
 * @return @throws
 *         SMException
 */
public Vector getRoles() throws SMException {
	Vector roles = new Vector();
	UserProvisioningManager userProvisioningManager = null;
	try {
		userProvisioningManager = getUserProvisioningManager();
		roles.add(userProvisioningManager.getRoleById(ADMINISTRATOR_ROLE));
		roles.add(userProvisioningManager.getRoleById(SUPERVISOR_ROLE));
		roles.add(userProvisioningManager.getRoleById(TECHNICIAN_ROLE));
		roles.add(userProvisioningManager.getRoleById(PUBLIC_ROLE));
	} catch (CSException e) {
		Logger.out.debug("Unable to get roles: Exception: "
				+ e.getMessage());
		throw new SMException(e.getMessage(), e);
	}
	return roles;
}
 
开发者ID:NCIP,项目名称:wustl-common-package,代码行数:24,代码来源:SecurityManager.java

示例2: modifyUser

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * Method modifyUser.
 * @param user User
 * @throws CSTransactionException
 * @see gov.nih.nci.security.UserProvisioningManager#modifyUser(User)
 */
public void modifyUser(User user)throws CSException,LoginException{
	
	User currUser = authorizationDAO.getUser(user.getLoginName());
	if(currUser.getPassword() == null || !currUser.getPassword().equalsIgnoreCase(user.getPassword()))
	{
		authorizationDAO.validateUser(user);
	}
	
	user.setUpdateDate(new java.util.Date());
	authorizationDAO.modifyObject(user);
	// update the password history here!!!
	if(currUser.getPassword()!=null && currUser.getPassword().length()>0)
	{
		if(!user.getPassword().equals(encryptPassword(currUser.getPassword(),"YES" )))
		{
		
			// insert into password history!!
			authorizationDAO.insertIntoPasswordHistory(currUser.getLoginName(), currUser.getPassword());
		
		}
	}
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:29,代码来源:AuthorizationManagerImpl.java

示例3: validateUser

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
@Override
public void validateUser(User user) throws CSException{
	//For LDAP user, password is empty. Password is not a required field.
	DataConfiguration config = ConfigurationHelper.getConfiguration();
	log.info("******Inside Validate User(((((()))))))))....");
	if(user.getPassword() != null && user.getPassword().trim().length() > 0)
	{
		validatePassword(user.getPassword());
		// added PV below
		
		if(user.getLoginName().equalsIgnoreCase(user.getPassword()))
		{
			throw new CSException("The password and LoginName should be different values...");
		}
		
		// added PV below 
		if(checkPasswordHistory(user.getLoginName(), user.getPassword(),Integer.parseInt(config.getString("PASSWORD_MATCH_NUM"))))
		{
			throw new CSException("The password should be different from the previous passwords");
		}
		
	}
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:24,代码来源:AuthorizationDAOImpl.java

示例4: deleteAuthorizedStudyElementsGroup

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void deleteAuthorizedStudyElementsGroup(StudyConfiguration studyConfiguration,
                                    AuthorizedStudyElementsGroup authorizedStudyElementsGroup) throws CSException {
    securityManager.deleteProtectionElement(authorizedStudyElementsGroup);
    studyConfiguration.getAuthorizedStudyElementsGroups().remove(authorizedStudyElementsGroup);
    Date lastModifiedDate = new Date();
    LogEntry logEntry = new LogEntry();
    UserWorkspace lastModifiedBy = studyConfiguration.getLastModifiedBy();
    logEntry.setUsername(lastModifiedBy == null ? null : lastModifiedBy.getUsername());
    logEntry.setLogDate(lastModifiedDate);
    logEntry.setTrimSystemLogMessage(LogEntry.getSystemLogDelete(authorizedStudyElementsGroup));
    studyConfiguration.getLogEntries().add(logEntry);
    getDao().delete(authorizedStudyElementsGroup);
    daoSave(studyConfiguration);
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:19,代码来源:StudyManagementServiceImpl.java

示例5: hasPrivilege

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
@SuppressWarnings("PMD.EmptyCatchBlock")
private static boolean hasPrivilege(Protectable p, User user, String privilege) {
    // if the protectable is not yet saved, assume user only has access if he is the current user
    if (p.getId() == null) {
        return CaArrayUsernameHolder.getCsmUser().equals(user);
    }
    try {
        final Application app = getApplication();
        return AuthorizationManagerExtensions.checkPermission(user.getLoginName(), getUnderlyingEntityClass(p)
                .getName(), "id", p.getId().toString(), privilege, app);
    } catch (final CSException e) {
        LOG.warn(String.format(
                "Could not check if User %s had privilege %s for protectable of class %s with id %s",
                user.getLoginName(), privilege, p.getClass().getName(), p.getId()));
        return false;
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:18,代码来源:SecurityUtils.java

示例6: testCheckPermissionStringStringStringString1

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
public void testCheckPermissionStringStringStringString1() throws InterruptedException
	{		
		try
		{
			boolean hasPermission = authorizationManagerUser.checkPermission("modik", "AuthPolicyTest2", "AuthPolicyTest2", "UPDATE");
			assertEquals(true,hasPermission);
			
			//TEST CODE, UNCOMMENT THIS CODE AS NEEDED
//			Thread.sleep(30000);  //Change or remove permissions in the database during this time
//			hasPermission = authorizationManagerUser.checkPermission("modik", "AuthPolicyTest2", "AuthPolicyTest2", "UPDATE");
//			assertEquals(false,hasPermission);
		}
		catch (CSException e)
		{
			throw new RuntimeException("Error in creating the Authorization Manager");
		}
	}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:AuthPolicyCachingQATest.java

示例7: localAuthenticate

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * Authenticates the username and password using the Common Security Module
 * 
 * @param username
 * @param password
 * @return
 */
private boolean localAuthenticate(String username, String password) throws AuthenticationException{
	 AuthenticationManager am = null;
	 
        boolean loggedIn = false;
        try {
            /**
    		 * TODO get application Ccontext from system properties
    		 */
            am = SecurityServiceProvider.getAuthenticationManager(application);
            loggedIn = am.login(username, password);

        } catch (CSException e) {
            throw new AuthenticationException("User Name or Password is not correct");		            
        }
        
        return loggedIn;
}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:25,代码来源:SecurityManager.java

示例8: getAuthenticationManagerCLM

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
private AuthenticationManager getAuthenticationManagerCLM(){
	if (authenticationManagerCLM == null )
	{
		try
		{
			authenticationManagerCLM = SecurityServiceProvider.getAuthenticationManager("CLM");
		}
		catch (CSException e)
		{
			fail();
		}
	}
	return authenticationManagerCLM;
}
 
开发者ID:NCIP,项目名称:common-security-module,代码行数:15,代码来源:AuthenicationManagerTest.java

示例9: testGetAccessibleGroupsStringString1

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
public void testGetAccessibleGroupsStringString1()
{
	try
	{
		List groups = authorizationManager.getAccessibleGroups("AuthPolicyTest1", "ACCESS");
		assertNotNull(groups);
		assertEquals(1, groups.size());
	}
	catch (CSException e)
	{
		throw new RuntimeException("Error in getting the accessible groups");
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:14,代码来源:GridAuthorizationTest.java

示例10: getAuthorizationManager

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * Returns the Authorization Manager for the caTISSUE Core. This method
 * follows the singleton pattern so that only one AuthorizationManager is
 * created.
 * 
 * @return @throws
 *         CSException
 */
protected AuthorizationManager getAuthorizationManager() throws CSException {

	if (authorizationManager == null) {
		synchronized (requestingClass) {
			if (authorizationManager == null) {
				authorizationManager = SecurityServiceProvider
						.getAuthorizationManager(CATISSUE_CORE_CONTEXT_NAME);
			}
		}
	}

	return authorizationManager;

}
 
开发者ID:NCIP,项目名称:wustl-common-package,代码行数:23,代码来源:SecurityManager.java

示例11: testCheckPermissionForGroupStringStringString1

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
public void testCheckPermissionForGroupStringStringString1()
{
	try
	{
		boolean hasPermission = authorizationManagerGroup.checkPermissionForGroup("AuthPolicyTest", "AuthPolicyTest1", "ACCESS");
		assertEquals(true,hasPermission);
	}
	catch (CSException e)
	{
		e.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:13,代码来源:AuthPolicyCachingTest.java

示例12: testLoginOpenLDAP3

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
public void testLoginOpenLDAP3() {
	
	boolean isValid = false;
	try
	{
		isValid = getAuthenticationManagerOpenLDAP().login( "csmuser1", "CSMt3st" );
	}
	catch(CSException cse)
	{
		isValid = false;
	}
	assertEquals(false, isValid);
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:14,代码来源:AuthenicationManagerTest.java

示例13: getUserProvisioningManager

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
/**
 * This method will provides the default implementation of the {@link UserProvisioningManager}. This Manager
 * is used only by the User Provisioning Tool and is not available for the applications to use at runtime. The 
 * methods exposed 
 * @param contextName The name of the Application for which the {@link UserProvisioningManager} is obtained
 * @return The implementation of the {@link UserProvisioningManager} interface is returned based on the
 * configuration for the application
 * @throws CSException if an instance of {@link UserProvisioningManager} could not be obtained
 * @throws CSConfigurationException 
 */
public static UserProvisioningManager getUserProvisioningManager(String contextName) throws CSException, CSConfigurationException{
	
	UserProvisioningManager userProvisioningManager = null;
	userProvisioningManager = getUserProvisioningManagerDirectly(contextName);
	if (userProvisioningManager == null)
	{
		AuthorizationManagerImpl userProvisioningManagerImpl = new AuthorizationManagerImpl(contextName);		
		userProvisioningManager = (UserProvisioningManager)userProvisioningManagerImpl;
	}
	
	return userProvisioningManager;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:23,代码来源:SecurityServiceProvider.java

示例14: validateLDAP

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
public static List<String> validateLDAP(String username, String password,
        List<String> errors) {
	
    AuthenticationManager am = null;
    boolean loggedIn = false;
    try {
        logger.debug("Testing Logging");            
        am = SecurityServiceProvider.getAuthenticationManager("rembrandt");
        loggedIn = am.login(username, password);

    } catch (CSException e) {
        logger.debug("loginFail");           

    }
    /**the following  if clause will only be used until the 
     * app is released as a backdoor for developers and non NIH
     * folks. Once the app is moved, this clause should also be removed.
     * -kevin rosso
     */
    if(username.equals("RBTuser") && password.equals("RBTpass")){
        loggedIn = true;
    }
    if(loggedIn) {
        logger.debug("loginSuccess");
    } else {
        logger.debug("loginFail"); 
        errors.add(ApplicationContext.getLabelProperties().getProperty("gov.nih.nci.nautilus.ui.struts.form.invalidLogin.error"));
    }
    return errors;
}
 
开发者ID:NCIP,项目名称:rembrandt,代码行数:31,代码来源:UIFormValidator.java

示例15: getAuthenticationManagerLDAP

import gov.nih.nci.security.exceptions.CSException; //导入依赖的package包/类
private AuthenticationManager getAuthenticationManagerLDAP(){
	if (authenticationManagerLdap == null )
	{
		try
		{
			authenticationManagerLdap = SecurityServiceProvider.getAuthenticationManager("LDAPGRID");
		}
		catch (CSException e)
		{
			fail("\nFailer in obtaining Authentication Manager for LDAPGRID\n");
		}
	}
	return authenticationManagerLdap;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:15,代码来源:QAGridAuthenticationTest.java


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