Skip to content

Commit

Permalink
Add allowOriginLoop yaml configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
strehle committed Jul 12, 2024
1 parent bcf65db commit 341bb3d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class UserConfig {

private boolean checkOriginEnabled;

private boolean allowAllOrigins = true;
private boolean allowOriginLoop = true;

public List<String> getDefaultGroups() {
return defaultGroups;
Expand Down Expand Up @@ -81,11 +81,11 @@ public void setCheckOriginEnabled(boolean checkOriginEnabled) {
this.checkOriginEnabled = checkOriginEnabled;
}

public boolean isAllowAllOrigins() {
return this.allowAllOrigins;
public boolean isAllowOriginLoop() {
return this.allowOriginLoop;
}

public void setAllowAllOrigins(final boolean allowAllOrigins) {
this.allowAllOrigins = allowAllOrigins;
public void setAllowOriginLoop(final boolean allowAllOrigins) {
this.allowOriginLoop = allowAllOrigins;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private int isOriginLoopAllowed(String zoneId, int checkDone) {
} else {
idzConfig = identityZoneProvisioning.retrieve(zoneId).getConfig();
}
return (idzConfig == null || Optional.of(idzConfig.getUserConfig()).map(UserConfig::isAllowAllOrigins).orElse(true)) ? 1 : 0;
return (idzConfig == null || Optional.of(idzConfig.getUserConfig()).map(UserConfig::isAllowOriginLoop).orElse(true)) ? 1 : 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void retrieve_by_issuer_not_found_error() throws Exception {

String issuer = "https://accounts.google.com";
IdentityZone extraZone = IdentityZone.getUaa();
extraZone.getConfig().getUserConfig().setAllowAllOrigins(false);
extraZone.getConfig().getUserConfig().setAllowOriginLoop(false);
when(identityZoneManager.getCurrentIdentityZoneId()).thenReturn(IdentityZone.getUaaZoneId());
when(identityZoneManager.getCurrentIdentityZone()).thenReturn(extraZone);
assertThrowsWithMessageThat(
Expand All @@ -243,7 +243,7 @@ void retrieve_by_issuer_null_error() throws Exception {

String issuer = "https://accounts.google.com";
IdentityZone extraZone = IdentityZone.getUaa();
extraZone.getConfig().getUserConfig().setAllowAllOrigins(false);
extraZone.getConfig().getUserConfig().setAllowOriginLoop(false);
when(identityZoneManager.getCurrentIdentityZoneId()).thenReturn(IdentityZone.getUaaZoneId());
when(identityZoneManager.getCurrentIdentityZone()).thenReturn(extraZone);
assertThrowsWithMessageThat(
Expand Down
1 change: 1 addition & 0 deletions uaa/src/main/webapp/WEB-INF/spring-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@
<property name="allowedGroups" value="${login.allowedGroups:#{null}}"/>
<property name="checkOriginEnabled" value="${login.checkOriginEnabled:false}"/>
<property name="maxUsers" value="${login.maxUsers:-1}"/>
<property name="allowOriginLoop" value="${login.allowOriginLoop:true}"/>
</bean>

<bean id="identityZoneConfigurationBootstrap"
Expand Down

0 comments on commit 341bb3d

Please sign in to comment.