Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-14843]
We can't merge the proposed patch as is, and we should switch to POST if that's what has to happen.
In the mean time, at least provide an escape hatch to allow people to bypass the team extension.

Run Jenkins with -Dhudson.plugins.openid.impl.TeamsExtension.disable=true to disable the team extension.
  • Loading branch information
kohsuke committed Nov 27, 2013
1 parent 48a59a5 commit e5bf3e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/hudson/plugins/openid/impl/TeamsExtension.java
Expand Up @@ -57,6 +57,8 @@
public class TeamsExtension extends OpenIdExtension {
@Override
public void extend(AuthRequest authRequest) throws MessageException {
if (DISABLE) return;

TeamExtensionRequest req = new TeamExtensionRequest();
Collection<String> groups = Hudson.getInstance().getAuthorizationStrategy().getGroups();
req.setQueryMembership(groups);
Expand All @@ -69,6 +71,8 @@ public void extend(AuthRequest authRequest) throws MessageException {

@Override
public void process(AuthSuccess authSuccess, Identity id) throws MessageException {
if (DISABLE) return;

TeamExtensionResponse ter = getMessageAs(TeamExtensionResponse.class, authSuccess, TeamExtensionFactory.URI);
List<GrantedAuthority> r = id.getGrantedAuthorities();
for (String s : ter.getTeamMembership())
Expand All @@ -85,4 +89,9 @@ public void process(AuthSuccess authSuccess, Identity id) throws MessageExceptio
}

private static final Logger LOGGER = Logger.getLogger(TeamsExtension.class.getName());

/**
* Escape hatch for people affected by JENKINS-14843 until we switch to POST.
*/
public static boolean DISABLE = Boolean.getBoolean(TeamsExtension.class.getName()+"disable");

This comment has been minimized.

Copy link
@johnrengelman

johnrengelman Jan 10, 2014

There is a missing . in this line. Should be: +".disable".

}

0 comments on commit e5bf3e9

Please sign in to comment.