test_class.declarator: encryCredentialManager
test_class.modifier: private
test_class.original_string: private EncryCredentialManagerImpl encryCredentialManager;
test_class.type: EncryCredentialManagerImpl
test_class.var_name: encryCredentialManager
test_class.file: ki4so-common/src/test/java/com/github/ebnew/ki4so/core/authentication/EncryCredentialManagerImplTest.java
test_class.identifier: EncryCredentialManagerImplTest
test_case.body: @Test
  	public void testCheckEncryCredentialInfo() {
  		
  		/**
  		 * 测试输入异常的情况。
  		 */
  		Assert.assertFalse(this.encryCredentialManager.checkEncryCredentialInfo(null));
  		
  		/**
  		 * 测试凭据信息的userId为空。
  		 */
  		EncryCredentialInfo encryCredentialInfo = new EncryCredentialInfo();
  		Assert.assertFalse(this.encryCredentialManager.checkEncryCredentialInfo(encryCredentialInfo));
  		
  		/**
  		 * 测试凭据信息的userId不为空，过期时间为空。
  		 */
  		String userId = "test";
  		encryCredentialInfo = new EncryCredentialInfo();
  		encryCredentialInfo.setUserId(userId);
  		Assert.assertFalse(this.encryCredentialManager.checkEncryCredentialInfo(encryCredentialInfo));
  		
  		
  		/**
  		 * 测试凭据信息的userId不为空，过期时间不为空，但是凭据已经过期的情况。
  		 */
  		encryCredentialInfo.setExpiredTime(new Date());
  		Assert.assertFalse(this.encryCredentialManager.checkEncryCredentialInfo(encryCredentialInfo));
  		
  	}
test_case.class_method_signature: EncryCredentialManagerImplTest.testCheckEncryCredentialInfo()
test_case.full_signature: @Test public void testCheckEncryCredentialInfo()
test_case.identifier: testCheckEncryCredentialInfo
test_case.invocations: assertFalse checkEncryCredentialInfo assertFalse checkEncryCredentialInfo setUserId assertFalse checkEncryCredentialInfo setExpiredTime assertFalse checkEncryCredentialInfo
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCheckEncryCredentialInfo()
focal_class.declarator: keyService
focal_class.modifier: private
focal_class.original_string: private KeyService keyService;
focal_class.type: KeyService
focal_class.var_name: keyService
focal_class.declarator: LOGGER = Logger.getLogger(EncryCredentialManagerImpl.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Logger.getLogger(EncryCredentialManagerImpl.class.getName());
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: ki4so-common/src/main/java/com/github/ebnew/ki4so/core/authentication/EncryCredentialManagerImpl.java
focal_class.identifier: EncryCredentialManagerImpl
focal_class.interfaces: implements EncryCredentialManager
focal_class.class_method_signature: EncryCredentialManagerImpl.setKeyService(KeyService keyService)
focal_class.full_signature: public void setKeyService(KeyService keyService)
focal_class.identifier: setKeyService
focal_class.modifiers: public
focal_class.parameters: (KeyService keyService)
focal_class.return: void
focal_class.signature: void setKeyService(KeyService keyService)
focal_class.class_method_signature: EncryCredentialManagerImpl.decrypt(EncryCredential encryCredential)
focal_class.full_signature: @Override public EncryCredentialInfo decrypt(EncryCredential encryCredential)
focal_class.identifier: decrypt
focal_class.modifiers: @Override public
focal_class.parameters: (EncryCredential encryCredential)
focal_class.return: EncryCredentialInfo
focal_class.signature: EncryCredentialInfo decrypt(EncryCredential encryCredential)
focal_class.class_method_signature: EncryCredentialManagerImpl.parseEncryCredential(String credential)
focal_class.full_signature: private EncryCredentialInfo parseEncryCredential(String credential)
focal_class.identifier: parseEncryCredential
focal_class.modifiers: private
focal_class.parameters: (String credential)
focal_class.return: EncryCredentialInfo
focal_class.signature: EncryCredentialInfo parseEncryCredential(String credential)
focal_class.class_method_signature: EncryCredentialManagerImpl.encrypt(EncryCredentialInfo encryCredentialInfo)
focal_class.full_signature: @Override public String encrypt(EncryCredentialInfo encryCredentialInfo)
focal_class.identifier: encrypt
focal_class.modifiers: @Override public
focal_class.parameters: (EncryCredentialInfo encryCredentialInfo)
focal_class.return: String
focal_class.signature: String encrypt(EncryCredentialInfo encryCredentialInfo)
focal_class.class_method_signature: EncryCredentialManagerImpl.encryptSensitiveInfo(EncryCredentialInfo encryCredentialInfo)
focal_class.full_signature: private String encryptSensitiveInfo(EncryCredentialInfo encryCredentialInfo)
focal_class.identifier: encryptSensitiveInfo
focal_class.modifiers: private
focal_class.parameters: (EncryCredentialInfo encryCredentialInfo)
focal_class.return: String
focal_class.signature: String encryptSensitiveInfo(EncryCredentialInfo encryCredentialInfo)
focal_class.class_method_signature: EncryCredentialManagerImpl.checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)
focal_class.full_signature: @Override public boolean checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)
focal_class.identifier: checkEncryCredentialInfo
focal_class.modifiers: @Override public
focal_class.parameters: (
  			EncryCredentialInfo encryCredentialInfo)
focal_class.return: boolean
focal_class.signature: boolean checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)
focal_class.class_method_signature: EncryCredentialManagerImpl.getCurrentDate()
focal_class.full_signature: private Date getCurrentDate()
focal_class.identifier: getCurrentDate
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Date
focal_class.signature: Date getCurrentDate()
focal_method.body: @Override
  	public boolean checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo) {
  		if(encryCredentialInfo!=null){
  			//无凭据对应的用户标识，则无效。
  			if(StringUtils.isEmpty(encryCredentialInfo.getUserId())){
  				return false;
  			}
  			Date now = getCurrentDate();
  			if(encryCredentialInfo.getExpiredTime()!=null){
  				//将未来过期时间减去当前时间。
  				long deta = encryCredentialInfo.getExpiredTime().getTime() - now.getTime();
  				//若差值大于0，表示过期时间还没有到，凭据继续可以有效使用。
  				if(deta>0){
  					return true;
  				}
  			}
  		}
  		return false;
  	}
focal_method.class_method_signature: EncryCredentialManagerImpl.checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)
focal_method.full_signature: @Override public boolean checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)
focal_method.identifier: checkEncryCredentialInfo
focal_method.invocations: isEmpty getUserId getCurrentDate getExpiredTime getTime getExpiredTime getTime
focal_method.modifiers: @Override public
focal_method.parameters: (
  			EncryCredentialInfo encryCredentialInfo)
focal_method.return: boolean
focal_method.signature: boolean checkEncryCredentialInfo(
  			EncryCredentialInfo encryCredentialInfo)