### Question:
OidcSupport implements Service { public static OidcSupport create(Config config, String providerName) { return create(OidcConfig.create(findMyKey(config, providerName))); } private  OidcSupport(OidcConfig oidcConfig); static OidcSupport create(Config config, String providerName); @Override void update(Routing.Rules rules); static OidcSupport create(Config config); static OidcSupport create(OidcConfig oidcConfig);  }### Answer:
@Test void testOutbound() { String tokenContent = "huhahihohyhe"; TokenCredential tokenCredential = TokenCredential.builder() .token(tokenContent) .build(); Subject subject = Subject.builder() .addPublicCredential(TokenCredential.class, tokenCredential) .build(); ProviderRequest providerRequest = Mockito.mock(ProviderRequest.class); SecurityContext ctx = Mockito.mock(SecurityContext.class); when(ctx.user()).thenReturn(Optional.of(subject)); when(providerRequest.securityContext()).thenReturn(ctx); SecurityEnvironment outboundEnv = SecurityEnvironment.builder() .targetUri(URI.create("http: .path("/test") .build(); EndpointConfig endpointConfig = EndpointConfig.builder().build(); OutboundSecurityResponse response = provider.syncOutbound(providerRequest, outboundEnv, endpointConfig); List<String> authorization = response.requestHeaders().get("Authorization"); assertThat("Authorization header", authorization, hasItem("bearer " + tokenContent)); }
@Test void testOutboundFull() { String tokenContent = "huhahihohyhe"; TokenCredential tokenCredential = TokenCredential.builder() .token(tokenContent) .build(); Subject subject = Subject.builder() .addPublicCredential(TokenCredential.class, tokenCredential) .build(); ProviderRequest providerRequest = Mockito.mock(ProviderRequest.class); SecurityContext ctx = Mockito.mock(SecurityContext.class); when(ctx.user()).thenReturn(Optional.of(subject)); when(providerRequest.securityContext()).thenReturn(ctx); SecurityEnvironment outboundEnv = SecurityEnvironment.builder() .targetUri(URI.create("http: .path("/test") .build(); EndpointConfig endpointConfig = EndpointConfig.builder().build(); boolean outboundSupported = provider.isOutboundSupported(providerRequest, outboundEnv, endpointConfig); assertThat("Outbound should not be supported by default", outboundSupported, is(false)); OutboundSecurityResponse response = provider.syncOutbound(providerRequest, outboundEnv, endpointConfig); assertThat("Disabled target should have empty headers", response.requestHeaders().size(), is(0)); }