test_class.declarator: VALID_USERNAME = "user"
test_class.modifier: private static final
test_class.original_string: private static final String VALID_USERNAME = "user";
test_class.type: String
test_class.var_name: VALID_USERNAME
test_class.declarator: VALID_PASSWORD = "password"
test_class.modifier: private static final
test_class.original_string: private static final String VALID_PASSWORD = "password";
test_class.type: String
test_class.var_name: VALID_PASSWORD
test_class.declarator: INVALID_PASSWORD = "invalid_password"
test_class.modifier: private static final
test_class.original_string: private static final String INVALID_PASSWORD = "invalid_password";
test_class.type: String
test_class.var_name: INVALID_PASSWORD
test_class.declarator: mockUserService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserService mockUserService;
test_class.type: UserService
test_class.var_name: mockUserService
test_class.declarator: mockDateTimeService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private DateTimeService mockDateTimeService;
test_class.type: DateTimeService
test_class.var_name: mockDateTimeService
test_class.declarator: defaultAuthenticationService
test_class.modifier: private
test_class.original_string: private DefaultAuthenticationService defaultAuthenticationService;
test_class.type: DefaultAuthenticationService
test_class.var_name: defaultAuthenticationService
test_class.file: application/confagrid-webapp/src/test/java/com/aleggeup/confagrid/auth/DefaultAuthenticationServiceTest.java
test_class.identifier: DefaultAuthenticationServiceTest
test_case.body: @Ignore("Remove until difference in time on build machine is figured out.")
      @Test
      public void testAuthenticationToken() {
          final UserEntity userEntity = new UserEntity();
          userEntity.setName(VALID_USERNAME);
          userEntity.setPassword(VALID_PASSWORD);
          userEntity.setRoleEntities(Collections.emptySet());
          final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
          final DateTime now = formatter.parseDateTime("1985-10-26 01:24:00").withZone(DateTimeZone.UTC);
          final Date expiry = new Date(1_000_000_000L);
  
          Mockito.when(mockUserService.findByName(VALID_USERNAME)).thenReturn(userEntity);
          Mockito.when(mockDateTimeService.now()).thenReturn(now);
          Mockito.when(mockDateTimeService.plusDaysAsDate(now, 1)).thenReturn(expiry);
  
          final String response = defaultAuthenticationService.authenticationToken(VALID_USERNAME, VALID_PASSWORD);
  
          Assert.assertEquals(
              "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwicm9sZXMiOltdLCJpYXQiOjQ5OTE2NjY0MCwiZXhwIjoxMDAwMDAwfQ.e14TR4Umu8UUz3GrYyXHQTkFickDFV1Vpgb8JaCz8EY",
              response);
  
          Mockito.verify(mockUserService).findByName(VALID_USERNAME);
          Mockito.verify(mockDateTimeService).now();
          Mockito.verify(mockDateTimeService).plusDaysAsDate(now, 1);
      }
test_case.class_method_signature: DefaultAuthenticationServiceTest.testAuthenticationToken()
test_case.full_signature: @Ignore("Remove until difference in time on build machine is figured out.") @Test public void testAuthenticationToken()
test_case.identifier: testAuthenticationToken
test_case.invocations: setName setPassword setRoleEntities emptySet forPattern withZone parseDateTime thenReturn when findByName thenReturn when now thenReturn when plusDaysAsDate authenticationToken assertEquals findByName verify now verify plusDaysAsDate verify
test_case.modifiers: @Ignore("Remove until difference in time on build machine is figured out.") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAuthenticationToken()
focal_class.declarator: TOKEN_INTERVAL_DAYS = 1
focal_class.modifier: private static final
focal_class.original_string: private static final int TOKEN_INTERVAL_DAYS = 1;
focal_class.type: int
focal_class.var_name: TOKEN_INTERVAL_DAYS
focal_class.declarator: userService
focal_class.modifier: private final
focal_class.original_string: private final UserService userService;
focal_class.type: UserService
focal_class.var_name: userService
focal_class.declarator: dateTimeService
focal_class.modifier: private final
focal_class.original_string: private final DateTimeService dateTimeService;
focal_class.type: DateTimeService
focal_class.var_name: dateTimeService
focal_class.file: application/confagrid-webapp/src/main/java/com/aleggeup/confagrid/auth/DefaultAuthenticationService.java
focal_class.identifier: DefaultAuthenticationService
focal_class.interfaces: implements AuthenticationService
focal_class.class_method_signature: DefaultAuthenticationService.DefaultAuthenticationService(final UserService userService, final DateTimeService dateTimeService)
focal_class.full_signature: @Autowired public  DefaultAuthenticationService(final UserService userService, final DateTimeService dateTimeService)
focal_class.identifier: DefaultAuthenticationService
focal_class.modifiers: @Autowired public
focal_class.parameters: (final UserService userService, final DateTimeService dateTimeService)
focal_class.signature:  DefaultAuthenticationService(final UserService userService, final DateTimeService dateTimeService)
focal_class.class_method_signature: DefaultAuthenticationService.userPasswordCheck(final String username, final String password)
focal_class.full_signature: @Override public boolean userPasswordCheck(final String username, final String password)
focal_class.identifier: userPasswordCheck
focal_class.modifiers: @Override public
focal_class.parameters: (final String username, final String password)
focal_class.return: boolean
focal_class.signature: boolean userPasswordCheck(final String username, final String password)
focal_class.class_method_signature: DefaultAuthenticationService.authenticationToken(final String username, final String password)
focal_class.full_signature: @Override public String authenticationToken(final String username, final String password)
focal_class.identifier: authenticationToken
focal_class.modifiers: @Override public
focal_class.parameters: (final String username, final String password)
focal_class.return: String
focal_class.signature: String authenticationToken(final String username, final String password)
focal_class.class_method_signature: DefaultAuthenticationService.anonymousToken()
focal_class.full_signature: @Override public String anonymousToken()
focal_class.identifier: anonymousToken
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String anonymousToken()
focal_method.body: @Override
      public String authenticationToken(final String username, final String password) {
          final UserEntity userEntity = userService.findByName(username);
          final DateTime now = dateTimeService.now();
  
          return Jwts.builder()
              .setSubject(userEntity.getName())
              .setId(userEntity.getId().toString())
              .claim("roles", userEntity.getRoleEntities())
              .setIssuedAt(now.toLocalDateTime().toDate())
              .setExpiration(dateTimeService.plusDaysAsDate(now, TOKEN_INTERVAL_DAYS))
              .signWith(SignatureAlgorithm.HS256, JwtFilter.SECRET_KEY)
              .compact();
      }
focal_method.class_method_signature: DefaultAuthenticationService.authenticationToken(final String username, final String password)
focal_method.full_signature: @Override public String authenticationToken(final String username, final String password)
focal_method.identifier: authenticationToken
focal_method.invocations: findByName now compact signWith setExpiration setIssuedAt claim setId setSubject builder getName toString getId getRoleEntities toDate toLocalDateTime plusDaysAsDate
focal_method.modifiers: @Override public
focal_method.parameters: (final String username, final String password)
focal_method.return: String
focal_method.signature: String authenticationToken(final String username, final String password)