test_class.declarator: DUMMY_AUTH_HEADER_NAME =
              org.eclipse.ditto.services.gateway.security.HttpHeader.X_DITTO_PRE_AUTH.getName()
test_class.modifier: private static final
test_class.original_string: private static final String DUMMY_AUTH_HEADER_NAME =
              org.eclipse.ditto.services.gateway.security.HttpHeader.X_DITTO_PRE_AUTH.getName();
test_class.type: String
test_class.var_name: DUMMY_AUTH_HEADER_NAME
test_class.declarator: DUMMY_AUTH_HEADER = HttpHeader.parse(DUMMY_AUTH_HEADER_NAME, "myDummy")
test_class.modifier: private static final
test_class.original_string: private static final HttpHeader DUMMY_AUTH_HEADER = HttpHeader.parse(DUMMY_AUTH_HEADER_NAME, "myDummy");
test_class.type: HttpHeader
test_class.var_name: DUMMY_AUTH_HEADER
test_class.declarator: DUMMY_AUTH_QUERY = Query.create(new Pair<>(DUMMY_AUTH_HEADER_NAME, "myDummy"))
test_class.modifier: private static final
test_class.original_string: private static final Query DUMMY_AUTH_QUERY = Query.create(new Pair<>(DUMMY_AUTH_HEADER_NAME, "myDummy"));
test_class.type: Query
test_class.var_name: DUMMY_AUTH_QUERY
test_class.declarator: testName = new TestName()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final TestName testName = new TestName();
test_class.type: TestName
test_class.var_name: testName
test_class.declarator: knownDittoHeaders
test_class.modifier: private
test_class.original_string: private DittoHeaders knownDittoHeaders;
test_class.type: DittoHeaders
test_class.var_name: knownDittoHeaders
test_class.declarator: underTest
test_class.modifier: private
test_class.original_string: private PreAuthenticatedAuthenticationProvider underTest;
test_class.type: PreAuthenticatedAuthenticationProvider
test_class.var_name: underTest
test_class.file: services/gateway/security/src/test/java/org/eclipse/ditto/services/gateway/security/authentication/preauth/PreAuthenticatedAuthenticationProviderTest.java
test_class.identifier: PreAuthenticatedAuthenticationProviderTest
test_case.body: @Test
      public void doExtractAuthenticationByHeader() {
          final RequestContext requestContext = mockRequestContext(DUMMY_AUTH_HEADER, null);
  
          final AuthenticationResult authenticationResult =
                  underTest.tryToAuthenticate(requestContext, knownDittoHeaders);
  
          assertThat(authenticationResult.isSuccess()).isTrue();
      }
test_case.class_method_signature: PreAuthenticatedAuthenticationProviderTest.doExtractAuthenticationByHeader()
test_case.full_signature: @Test public void doExtractAuthenticationByHeader()
test_case.identifier: doExtractAuthenticationByHeader
test_case.invocations: mockRequestContext tryToAuthenticate isTrue assertThat isSuccess
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void doExtractAuthenticationByHeader()
focal_class.declarator: LOGGER =
              DittoLoggerFactory.getLogger(PreAuthenticatedAuthenticationProvider.class)
focal_class.modifier: private static final
focal_class.original_string: private static final DittoLogger LOGGER =
              DittoLoggerFactory.getLogger(PreAuthenticatedAuthenticationProvider.class);
focal_class.type: DittoLogger
focal_class.var_name: LOGGER
focal_class.declarator: INSTANCE = new PreAuthenticatedAuthenticationProvider()
focal_class.modifier: private static final
focal_class.original_string: private static final PreAuthenticatedAuthenticationProvider INSTANCE = new PreAuthenticatedAuthenticationProvider();
focal_class.type: PreAuthenticatedAuthenticationProvider
focal_class.var_name: INSTANCE
focal_class.file: services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/preauth/PreAuthenticatedAuthenticationProvider.java
focal_class.identifier: PreAuthenticatedAuthenticationProvider
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.PreAuthenticatedAuthenticationProvider()
focal_class.full_signature: private  PreAuthenticatedAuthenticationProvider()
focal_class.identifier: PreAuthenticatedAuthenticationProvider
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  PreAuthenticatedAuthenticationProvider()
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getInstance()
focal_class.full_signature: public static PreAuthenticatedAuthenticationProvider getInstance()
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: PreAuthenticatedAuthenticationProvider
focal_class.signature: PreAuthenticatedAuthenticationProvider getInstance()
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.isApplicable(final RequestContext requestContext)
focal_class.full_signature: @Override public boolean isApplicable(final RequestContext requestContext)
focal_class.identifier: isApplicable
focal_class.modifiers: @Override public
focal_class.parameters: (final RequestContext requestContext)
focal_class.return: boolean
focal_class.signature: boolean isApplicable(final RequestContext requestContext)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.containsHeader(final RequestContext requestContext, final HttpHeader header)
focal_class.full_signature: private static boolean containsHeader(final RequestContext requestContext, final HttpHeader header)
focal_class.identifier: containsHeader
focal_class.modifiers: private static
focal_class.parameters: (final RequestContext requestContext, final HttpHeader header)
focal_class.return: boolean
focal_class.signature: boolean containsHeader(final RequestContext requestContext, final HttpHeader header)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getRequestParam(final RequestContext requestContext, final HttpHeader header)
focal_class.full_signature: private static Optional<String> getRequestParam(final RequestContext requestContext, final HttpHeader header)
focal_class.identifier: getRequestParam
focal_class.modifiers: private static
focal_class.parameters: (final RequestContext requestContext, final HttpHeader header)
focal_class.return: Optional<String>
focal_class.signature: Optional<String> getRequestParam(final RequestContext requestContext, final HttpHeader header)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_class.full_signature: @Override protected AuthenticationResult tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_class.identifier: tryToAuthenticate
focal_class.modifiers: @Override protected
focal_class.parameters: (final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_class.return: AuthenticationResult
focal_class.signature: AuthenticationResult tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getPreAuthenticated(final RequestContext requestContext)
focal_class.full_signature: private static Optional<String> getPreAuthenticated(final RequestContext requestContext)
focal_class.identifier: getPreAuthenticated
focal_class.modifiers: private static
focal_class.parameters: (final RequestContext requestContext)
focal_class.return: Optional<String>
focal_class.signature: Optional<String> getPreAuthenticated(final RequestContext requestContext)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getAuthenticationFailedException(final DittoHeaders dittoHeaders)
focal_class.full_signature: private static DittoRuntimeException getAuthenticationFailedException(final DittoHeaders dittoHeaders)
focal_class.identifier: getAuthenticationFailedException
focal_class.modifiers: private static
focal_class.parameters: (final DittoHeaders dittoHeaders)
focal_class.return: DittoRuntimeException
focal_class.signature: DittoRuntimeException getAuthenticationFailedException(final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getAuthorizationSubjects(final String subjectsCommaSeparated)
focal_class.full_signature: private static List<AuthorizationSubject> getAuthorizationSubjects(final String subjectsCommaSeparated)
focal_class.identifier: getAuthorizationSubjects
focal_class.modifiers: private static
focal_class.parameters: (final String subjectsCommaSeparated)
focal_class.return: List<AuthorizationSubject>
focal_class.signature: List<AuthorizationSubject> getAuthorizationSubjects(final String subjectsCommaSeparated)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.buildFailedToExtractAuthorizationSubjectsException(
              final String preAuthenticatedSubject, final DittoHeaders dittoHeaders)
focal_class.full_signature: private static DittoRuntimeException buildFailedToExtractAuthorizationSubjectsException(
              final String preAuthenticatedSubject, final DittoHeaders dittoHeaders)
focal_class.identifier: buildFailedToExtractAuthorizationSubjectsException
focal_class.modifiers: private static
focal_class.parameters: (
              final String preAuthenticatedSubject, final DittoHeaders dittoHeaders)
focal_class.return: DittoRuntimeException
focal_class.signature: DittoRuntimeException buildFailedToExtractAuthorizationSubjectsException(
              final String preAuthenticatedSubject, final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.toFailedAuthenticationResult(final Throwable throwable,
              final DittoHeaders dittoHeaders)
focal_class.full_signature: @Override protected AuthenticationResult toFailedAuthenticationResult(final Throwable throwable,
              final DittoHeaders dittoHeaders)
focal_class.identifier: toFailedAuthenticationResult
focal_class.modifiers: @Override protected
focal_class.parameters: (final Throwable throwable,
              final DittoHeaders dittoHeaders)
focal_class.return: AuthenticationResult
focal_class.signature: AuthenticationResult toFailedAuthenticationResult(final Throwable throwable,
              final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PreAuthenticatedAuthenticationProvider.getType(final RequestContext requestContext)
focal_class.full_signature: @Override public AuthorizationContextType getType(final RequestContext requestContext)
focal_class.identifier: getType
focal_class.modifiers: @Override public
focal_class.parameters: (final RequestContext requestContext)
focal_class.return: AuthorizationContextType
focal_class.signature: AuthorizationContextType getType(final RequestContext requestContext)
focal_class.superclass: extends TimeMeasuringAuthenticationProvider<AuthenticationResult>
focal_method.body: @Override
      protected AuthenticationResult tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders) {
  
          final Optional<String> preAuthOpt = getPreAuthenticated(requestContext);
  
          if (preAuthOpt.isEmpty()) {
              return DefaultAuthenticationResult.failed(dittoHeaders, getAuthenticationFailedException(dittoHeaders));
          }
  
          final String preAuthenticatedSubject = preAuthOpt.get();
  
          final List<AuthorizationSubject> authorizationSubjects = getAuthorizationSubjects(preAuthenticatedSubject);
          if (authorizationSubjects.isEmpty()) {
              return toFailedAuthenticationResult(
                      buildFailedToExtractAuthorizationSubjectsException(preAuthenticatedSubject, dittoHeaders),
                      dittoHeaders);
          }
  
          final AuthorizationContext authContext =
                  AuthorizationModelFactory.newAuthContext(DittoAuthorizationContextType.PRE_AUTHENTICATED_HTTP,
                          authorizationSubjects);
  
          LOGGER.withCorrelationId(dittoHeaders)
                  .info("Pre-authentication has been applied resulting in AuthorizationContext <{}>.", authContext);
  
          return DefaultAuthenticationResult.successful(dittoHeaders, authContext);
      }
focal_method.class_method_signature: PreAuthenticatedAuthenticationProvider.tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_method.full_signature: @Override protected AuthenticationResult tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_method.identifier: tryToAuthenticate
focal_method.invocations: getPreAuthenticated isEmpty failed getAuthenticationFailedException get getAuthorizationSubjects isEmpty toFailedAuthenticationResult buildFailedToExtractAuthorizationSubjectsException newAuthContext info withCorrelationId successful
focal_method.modifiers: @Override protected
focal_method.parameters: (final RequestContext requestContext,
              final DittoHeaders dittoHeaders)
focal_method.return: AuthenticationResult
focal_method.signature: AuthenticationResult tryToAuthenticate(final RequestContext requestContext,
              final DittoHeaders dittoHeaders)