test_class.declarator: digestAuthenticationProvider
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private DigestAuthenticationProvider digestAuthenticationProvider;
test_class.type: DigestAuthenticationProvider
test_class.var_name: digestAuthenticationProvider
test_class.declarator: oadrSecurityRoleService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private OadrSecurityRoleService oadrSecurityRoleService;
test_class.type: OadrSecurityRoleService
test_class.var_name: oadrSecurityRoleService
test_class.declarator: oadrUserService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private OadrUserService oadrUserService;
test_class.type: OadrUserService
test_class.var_name: oadrUserService
test_class.declarator: oadrAppService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private OadrAppService oadrAppService;
test_class.type: OadrAppService
test_class.var_name: oadrAppService
test_class.declarator: venService
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private VenService venService;
test_class.type: VenService
test_class.var_name: venService
test_class.declarator: vtnConfig
test_class.modifier: @Resource
  	private
test_class.original_string: @Resource
  	private VtnConfig vtnConfig;
test_class.type: VtnConfig
test_class.var_name: vtnConfig
test_class.declarator: adminUser = null
test_class.modifier: private
test_class.original_string: private OadrUser adminUser = null;
test_class.type: OadrUser
test_class.var_name: adminUser
test_class.declarator: passwordUser = null
test_class.modifier: private
test_class.original_string: private OadrUser passwordUser = null;
test_class.type: OadrUser
test_class.var_name: passwordUser
test_class.declarator: appUser = null
test_class.modifier: private
test_class.original_string: private OadrApp appUser = null;
test_class.type: OadrApp
test_class.var_name: appUser
test_class.declarator: venUser = null
test_class.modifier: private
test_class.original_string: private Ven venUser = null;
test_class.type: Ven
test_class.var_name: venUser
test_class.declarator: venX509 = null
test_class.modifier: private
test_class.original_string: private Ven venX509 = null;
test_class.type: Ven
test_class.var_name: venX509
test_class.file: OpenADRServerVTNCommon/src/test/java/com/avob/openadr/server/common/vtn/security/OadrSecurityRoleServiceTest.java
test_class.identifier: OadrSecurityRoleServiceTest
test_case.body: @Test
  	public void grantX509RoleTest() throws OadrSecurityException {
  		X509Certificate cert = OadrPKISecurity.parseCertificate("src/test/resources/cert/test.crt");
  		String fingerprint = OadrFingerprintSecurity.getOadr20bFingerprint(cert);
  		User grantX509Role = oadrSecurityRoleService.grantX509Role(fingerprint);
  		List<GrantedAuthority> authorities = new ArrayList<>(grantX509Role.getAuthorities());
  		assertEquals(1, authorities.size());
  		assertEquals("ROLE_VEN", authorities.get(0).getAuthority());
  
  		venX509.setRegistrationId("registrationId");
  		venService.save(venX509);
  
  		grantX509Role = oadrSecurityRoleService.grantX509Role(fingerprint);
  		authorities = new ArrayList<>(grantX509Role.getAuthorities());
  		assertEquals(2, authorities.size());
  		assertTrue(authorities.get(1).getAuthority().equals("ROLE_VEN")
  				|| authorities.get(1).getAuthority().equals("ROLE_REGISTERED"));
  		assertTrue(authorities.get(0).getAuthority().equals("ROLE_VEN")
  				|| authorities.get(0).getAuthority().equals("ROLE_REGISTERED"));
  
  		grantX509Role = oadrSecurityRoleService.grantX509Role(vtnConfig.getOadr20bFingerprint());
  		authorities = new ArrayList<>(grantX509Role.getAuthorities());
  		assertEquals(1, authorities.size());
  		assertEquals("ROLE_VTN", authorities.get(0).getAuthority());
  
  		boolean exception = false;
  		try {
  			oadrSecurityRoleService.grantX509Role("mouaiccool");
  		} catch (Exception e) {
  			exception = true;
  		}
  		assertTrue(exception);
  	}
test_case.class_method_signature: OadrSecurityRoleServiceTest.grantX509RoleTest()
test_case.full_signature: @Test public void grantX509RoleTest()
test_case.identifier: grantX509RoleTest
test_case.invocations: parseCertificate getOadr20bFingerprint grantX509Role getAuthorities assertEquals size assertEquals getAuthority get setRegistrationId save grantX509Role getAuthorities assertEquals size assertTrue equals getAuthority get equals getAuthority get assertTrue equals getAuthority get equals getAuthority get grantX509Role getOadr20bFingerprint getAuthorities assertEquals size assertEquals getAuthority get grantX509Role assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void grantX509RoleTest()
focal_class.declarator: vtnConfig
focal_class.modifier: @Resource
  	private
focal_class.original_string: @Resource
  	private VtnConfig vtnConfig;
focal_class.type: VtnConfig
focal_class.var_name: vtnConfig
focal_class.declarator: abstractUserDao
focal_class.modifier: @Resource
  	private
focal_class.original_string: @Resource
  	private AbstractUserDao abstractUserDao;
focal_class.type: AbstractUserDao
focal_class.var_name: abstractUserDao
focal_class.declarator: encoder = new BCryptPasswordEncoder()
focal_class.modifier: private
focal_class.original_string: private BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
focal_class.type: BCryptPasswordEncoder
focal_class.var_name: encoder
focal_class.file: OpenADRServerVTNCommon/src/main/java/com/avob/openadr/server/common/vtn/security/OadrSecurityRoleService.java
focal_class.identifier: OadrSecurityRoleService
focal_class.class_method_signature: OadrSecurityRoleService.digestUserDetail(String username)
focal_class.full_signature: public User digestUserDetail(String username)
focal_class.identifier: digestUserDetail
focal_class.modifiers: public
focal_class.parameters: (String username)
focal_class.return: User
focal_class.signature: User digestUserDetail(String username)
focal_class.class_method_signature: OadrSecurityRoleService.grantDigestRole(String username, String password)
focal_class.full_signature: public User grantDigestRole(String username, String password)
focal_class.identifier: grantDigestRole
focal_class.modifiers: public
focal_class.parameters: (String username, String password)
focal_class.return: User
focal_class.signature: User grantDigestRole(String username, String password)
focal_class.class_method_signature: OadrSecurityRoleService.grantBasicRole(String username, CharSequence rawPassword)
focal_class.full_signature: public User grantBasicRole(String username, CharSequence rawPassword)
focal_class.identifier: grantBasicRole
focal_class.modifiers: public
focal_class.parameters: (String username, CharSequence rawPassword)
focal_class.return: User
focal_class.signature: User grantBasicRole(String username, CharSequence rawPassword)
focal_class.class_method_signature: OadrSecurityRoleService.grantX509Role(String username)
focal_class.full_signature: public User grantX509Role(String username)
focal_class.identifier: grantX509Role
focal_class.modifiers: public
focal_class.parameters: (String username)
focal_class.return: User
focal_class.signature: User grantX509Role(String username)
focal_class.class_method_signature: OadrSecurityRoleService.saveFindUser(String username)
focal_class.full_signature: private AbstractUser saveFindUser(String username)
focal_class.identifier: saveFindUser
focal_class.modifiers: private
focal_class.parameters: (String username)
focal_class.return: AbstractUser
focal_class.signature: AbstractUser saveFindUser(String username)
focal_class.class_method_signature: OadrSecurityRoleService.grantRole(AbstractUser abstractUser, String password)
focal_class.full_signature: private User grantRole(AbstractUser abstractUser, String password)
focal_class.identifier: grantRole
focal_class.modifiers: private
focal_class.parameters: (AbstractUser abstractUser, String password)
focal_class.return: User
focal_class.signature: User grantRole(AbstractUser abstractUser, String password)
focal_method.body: public User grantX509Role(String username) {
  
  		if (username.equals(vtnConfig.getOadr20bFingerprint())) {
  			return new User(username, "", Lists.newArrayList(new SimpleGrantedAuthority("ROLE_VTN")));
  		}
  		return this.grantRole(saveFindUser(username), "");
  	}
focal_method.class_method_signature: OadrSecurityRoleService.grantX509Role(String username)
focal_method.full_signature: public User grantX509Role(String username)
focal_method.identifier: grantX509Role
focal_method.invocations: equals getOadr20bFingerprint newArrayList grantRole saveFindUser
focal_method.modifiers: public
focal_method.parameters: (String username)
focal_method.return: User
focal_method.signature: User grantX509Role(String username)