title: Spring security oauth2 fails issuer validation after 30 seconds
body: <p>In a reactive spring webflux service, I have the endpoints configured to be protected by OAuth2 resource server. When I first launch the server, it validates the Bearer tokens properly but after about 30 seconds, the exact same requests begin failing with the following error:</p>
  
  <pre><code>error="invalid_token"
  error_description="This iss claim is not equal to the configured issuer"
  error_uri="https://tools.ietf.org/html/rfc6750#section-3.1"
  </code></pre>
  
  <p>I've verified that the token is valid and that the <code>iss</code> claim appears to be the same as what is configured in <code>spring.security.oauth2.resourceserver.jwt.issuer-uri</code>. If this wasn't configured properly, then I would be getting no valid requests.</p>
  
  <p>Upon closer inspection, I've found that the error stems from the <code>URL</code> comparison of the <code>iss</code> claim and the expected URL in that the <code>InetAddress.getAddress()</code> match for the first 30 seconds, but then do not match. This is using an Azure AD provider endpoint <code>https://sts.windows.net/{{tenantId}}/</code> and I've verified that the URL <em>strings</em> match, just not the internal addresses. What might be causing this and how can I validate tokens with valid issuers after the initial 30 seconds? Thanks.</p>
  
  <p>For reference, here is my <code>SecurityWebFilterChain</code>:</p>
  
  <pre><code>@Bean
  public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
      return http
              .csrf().disable()
              .authorizeExchange().anyExchange().authenticated()
              .and().oauth2ResourceServer().jwt().and()
              .and().build();
  }
  </code></pre>
  
  <p>Gradle implementations included:</p>
  
  <pre><code>org.springframework.boot:spring-boot-starter-security:2.1.0.RC1
  org.springframework.boot:spring-boot-starter-webflux:2.1.0.RC1
  org.springframework.security:spring-security-oauth2-resource-server:5.1.1.RELEASE
  org.springframework.security:spring-security-oauth2-jose:5.1.1.RELEASE
  </code></pre>