Add missing calls to principalName

Issue gh-8054
This commit is contained in:
Josh Cummings
2020-03-03 17:11:42 -07:00
parent 3766322f03
commit 85b0e468ad
5 changed files with 104 additions and 4 deletions

View File

@@ -785,16 +785,18 @@ public class SecurityMockServerConfigurers {
.clientRegistration(this.clientRegistration)
.principalName(token.getPrincipal().getName())
.beforeServerCreated(builder);
mockAuthentication(getToken()).beforeServerCreated(builder);
mockAuthentication(token).beforeServerCreated(builder);
}
@Override
public void afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec) {
OAuth2AuthenticationToken token = getToken();
mockOAuth2Client()
.accessToken(this.accessToken)
.clientRegistration(this.clientRegistration)
.principalName(token.getPrincipal().getName())
.afterConfigureAdded(serverSpec);
mockAuthentication(getToken()).afterConfigureAdded(serverSpec);
mockAuthentication(token).afterConfigureAdded(serverSpec);
}
@Override
@@ -806,6 +808,7 @@ public class SecurityMockServerConfigurers {
mockOAuth2Client()
.accessToken(this.accessToken)
.clientRegistration(this.clientRegistration)
.principalName(token.getPrincipal().getName())
.afterConfigurerAdded(builder, httpHandlerBuilder, connector);
mockAuthentication(token).afterConfigurerAdded(builder, httpHandlerBuilder, connector);
}
@@ -953,18 +956,21 @@ public class SecurityMockServerConfigurers {
OAuth2AuthenticationToken token = getToken();
mockOAuth2Client()
.accessToken(this.accessToken)
.principalName(token.getPrincipal().getName())
.clientRegistration(this.clientRegistration)
.beforeServerCreated(builder);
mockAuthentication(getToken()).beforeServerCreated(builder);
mockAuthentication(token).beforeServerCreated(builder);
}
@Override
public void afterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec) {
OAuth2AuthenticationToken token = getToken();
mockOAuth2Client()
.accessToken(this.accessToken)
.principalName(token.getPrincipal().getName())
.clientRegistration(this.clientRegistration)
.afterConfigureAdded(serverSpec);
mockAuthentication(getToken()).afterConfigureAdded(serverSpec);
mockAuthentication(token).afterConfigureAdded(serverSpec);
}
@Override
@@ -975,6 +981,7 @@ public class SecurityMockServerConfigurers {
OAuth2AuthenticationToken token = getToken();
mockOAuth2Client()
.accessToken(this.accessToken)
.principalName(token.getPrincipal().getName())
.clientRegistration(this.clientRegistration)
.afterConfigurerAdded(builder, httpHandlerBuilder, connector);
mockAuthentication(token).afterConfigurerAdded(builder, httpHandlerBuilder, connector);