test_class.declarator: p1
test_class.modifier: private
test_class.original_string: private Privilege p1;
test_class.type: Privilege
test_class.var_name: p1
test_class.declarator: p2
test_class.modifier: private
test_class.original_string: private Privilege p2;
test_class.type: Privilege
test_class.var_name: p2
test_class.declarator: p3
test_class.modifier: private
test_class.original_string: private Privilege p3;
test_class.type: Privilege
test_class.var_name: p3
test_class.declarator: userDetailsService
test_class.modifier: private
test_class.original_string: private AbiquoUserDetailsService userDetailsService;
test_class.type: AbiquoUserDetailsService
test_class.var_name: userDetailsService
test_class.file: api/src/test/java/com/abiquo/api/spring/security/AbiquoUserDetailsServiceTest.java
test_class.identifier: AbiquoUserDetailsServiceTest
test_class.superclass: extends AbstractGeneratorTest
test_case.body: @Test
      public void testLoadUserAuthoritiesWithMultiplePrivileges() throws Exception
      {
          Role role = roleGenerator.createInstance(p1, p2);
          User user = userGenerator.createInstance(role);
          setup(role, user.getEnterprise(), user);
  
          GrantedAuthority[] privileges = userDetailsService.loadUserAuthorities(user);
          assertEquals(privileges.length, 2 + 1); // 2 real privileges + ROLE_AUTHENTICATED
      }
test_case.class_method_signature: AbiquoUserDetailsServiceTest.testLoadUserAuthoritiesWithMultiplePrivileges()
test_case.full_signature: @Test public void testLoadUserAuthoritiesWithMultiplePrivileges()
test_case.identifier: testLoadUserAuthoritiesWithMultiplePrivileges
test_case.invocations: createInstance createInstance setup getEnterprise loadUserAuthorities assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLoadUserAuthoritiesWithMultiplePrivileges()
focal_class.declarator: DEFAULT_ROLE_PREFIX = "ROLE_"
focal_class.modifier: public static final
focal_class.original_string: public static final String DEFAULT_ROLE_PREFIX = "ROLE_";
focal_class.type: String
focal_class.var_name: DEFAULT_ROLE_PREFIX
focal_class.declarator: DEFAULT_ROLE = DEFAULT_ROLE_PREFIX + "AUTHENTICATED"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String DEFAULT_ROLE = DEFAULT_ROLE_PREFIX + "AUTHENTICATED";
focal_class.type: String
focal_class.var_name: DEFAULT_ROLE
focal_class.declarator: enterpriseRep
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected EnterpriseRep enterpriseRep;
focal_class.type: EnterpriseRep
focal_class.var_name: enterpriseRep
focal_class.declarator: authType
focal_class.modifier: protected
focal_class.original_string: protected AuthType authType;
focal_class.type: AuthType
focal_class.var_name: authType
focal_class.file: api/src/main/java/com/abiquo/api/spring/security/AbiquoUserDetailsService.java
focal_class.identifier: AbiquoUserDetailsService
focal_class.interfaces: implements UserDetailsService, UserLoginService
focal_class.class_method_signature: AbiquoUserDetailsService.getAuthType()
focal_class.full_signature: public AuthType getAuthType()
focal_class.identifier: getAuthType
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: AuthType
focal_class.signature: AuthType getAuthType()
focal_class.class_method_signature: AbiquoUserDetailsService.setAuthType(final AuthType authType)
focal_class.full_signature: public void setAuthType(final AuthType authType)
focal_class.identifier: setAuthType
focal_class.modifiers: public
focal_class.parameters: (final AuthType authType)
focal_class.return: void
focal_class.signature: void setAuthType(final AuthType authType)
focal_class.class_method_signature: AbiquoUserDetailsService.init()
focal_class.full_signature: @PostConstruct public void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: AbiquoUserDetailsService.loadUserByUsername(final String username)
focal_class.full_signature: @Override public UserDetails loadUserByUsername(final String username)
focal_class.identifier: loadUserByUsername
focal_class.modifiers: @Override public
focal_class.parameters: (final String username)
focal_class.return: UserDetails
focal_class.signature: UserDetails loadUserByUsername(final String username)
focal_class.class_method_signature: AbiquoUserDetailsService.getUserDetails(final User user)
focal_class.full_signature: @Override public UserDetails getUserDetails(final User user)
focal_class.identifier: getUserDetails
focal_class.modifiers: @Override public
focal_class.parameters: (final User user)
focal_class.return: UserDetails
focal_class.signature: UserDetails getUserDetails(final User user)
focal_class.class_method_signature: AbiquoUserDetailsService.loadUserAuthorities(final User user)
focal_class.full_signature: protected GrantedAuthority[] loadUserAuthorities(final User user)
focal_class.identifier: loadUserAuthorities
focal_class.modifiers: protected
focal_class.parameters: (final User user)
focal_class.return: GrantedAuthority[]
focal_class.signature: GrantedAuthority[] loadUserAuthorities(final User user)
focal_method.body: protected GrantedAuthority[] loadUserAuthorities(final User user)
      {
          List<Privilege> privileges = user.getRole().getPrivileges();
          ArrayList<String> grantedAuthority = new ArrayList<String>();
  
          // Adding default role
          grantedAuthority.add(DEFAULT_ROLE);
  
          if (privileges != null)
          {
              for (Privilege privilege : privileges)
              {
                  grantedAuthority.add(DEFAULT_ROLE_PREFIX + privilege.getName());
              }
          }
  
          return AuthorityUtils.stringArrayToAuthorityArray(grantedAuthority
              .toArray(new String[grantedAuthority.size()]));
      }
focal_method.class_method_signature: AbiquoUserDetailsService.loadUserAuthorities(final User user)
focal_method.full_signature: protected GrantedAuthority[] loadUserAuthorities(final User user)
focal_method.identifier: loadUserAuthorities
focal_method.invocations: getPrivileges getRole add add getName stringArrayToAuthorityArray toArray size
focal_method.modifiers: protected
focal_method.parameters: (final User user)
focal_method.return: GrantedAuthority[]
focal_method.signature: GrantedAuthority[] loadUserAuthorities(final User user)