-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the plugin towards the 1.6.0 release #33
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Build the plugin using https://github.com/jenkins-infra/pipeline-library | ||
buildPlugin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,20 @@ | |
<parent> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>2.37</version> | ||
<version>3.2</version> | ||
</parent> | ||
|
||
<artifactId>reverse-proxy-auth-plugin</artifactId> | ||
<version>1.5.1-SNAPSHOT</version> | ||
<version>1.6.0-SNAPSHOT</version> | ||
<packaging>hpi</packaging> | ||
|
||
<properties> | ||
<jenkins.version>1.625.3</jenkins.version> | ||
<java.level>7</java.level> | ||
</properties> | ||
|
||
<name>Jenkins Reverse Proxy Auth Plugin</name> | ||
<url>http://wiki.jenkins-ci.org/display/JENKINS/Reverse+Proxy+Auth+Plugin</url> | ||
<url>https://wiki.jenkins.io/display/JENKINS/Reverse+Proxy+Auth+Plugin</url> | ||
|
||
<developers> | ||
<developer> | ||
|
@@ -24,12 +29,23 @@ | |
<name>Wilder Rodrigues</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
<developer> | ||
<id>oleg_nenashev</id> | ||
<name>Oleg Nenashev</name> | ||
</developer> | ||
<developer> | ||
<id>wfollonier</id> | ||
<name>Wadeck Follonier</name> | ||
</developer> | ||
</developers> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}.git</connection> | ||
<developerConnection>scm:git:[email protected]:jenkinsci/${project.artifactId}.git</developerConnection> | ||
<url>https://github.com/jenkinsci/${project.artifactId}</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
|
@@ -46,21 +62,14 @@ | |
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>maven.jenkins-ci.org</id> | ||
<url>http://maven.jenkins-ci.org:8081/content/repositories/releases/</url> | ||
</repository> | ||
</distributionManagement> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
<url>https://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package org.jenkinsci.plugins.reverse_proxy_auth.auth; | ||
|
||
import java.util.Arrays; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import org.acegisecurity.AcegiMessageSource; | ||
import org.acegisecurity.Authentication; | ||
import org.acegisecurity.GrantedAuthority; | ||
|
@@ -16,6 +18,9 @@ | |
import org.springframework.context.support.MessageSourceAccessor; | ||
import org.springframework.util.Assert; | ||
|
||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
/** | ||
* @author Wilder Rodrigues ([email protected]) | ||
|
@@ -25,17 +30,18 @@ public class DefaultReverseProxyAuthenticator implements ReverseProxyAuthenticat | |
private static final Logger LOGGER = Logger | ||
.getLogger(ReverseProxySecurityRealm.class.getName()); | ||
|
||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "It is a part of public API :(") | ||
protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor(); | ||
|
||
private final String username; | ||
private final GrantedAuthority[] authorities; | ||
|
||
public DefaultReverseProxyAuthenticator(String username, GrantedAuthority[] authorities) { | ||
public DefaultReverseProxyAuthenticator(String username, @CheckForNull GrantedAuthority[] authorities) { | ||
this.username = username; | ||
this.authorities = authorities; | ||
this.authorities = authorities != null ? Arrays.copyOf(authorities, authorities.length) : null; | ||
} | ||
|
||
public void setMessageSource(MessageSource messageSource) { | ||
public void setMessageSource(@Nonnull MessageSource messageSource) { | ||
Assert.notNull("Message source must not be null"); | ||
messages = new MessageSourceAccessor(messageSource); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
src/main/java/org/jenkinsci/plugins/reverse_proxy_auth/model/ReverseProxyUserDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
package org.jenkinsci.plugins.reverse_proxy_auth.model; | ||
|
||
import javax.annotation.CheckForNull; | ||
import javax.naming.directory.Attributes; | ||
import javax.naming.directory.BasicAttributes; | ||
|
||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import org.acegisecurity.GrantedAuthority; | ||
import org.acegisecurity.userdetails.UserDetails; | ||
|
||
import java.util.Arrays; | ||
|
||
/** | ||
* @author Wilder Rodrigues ([email protected]) | ||
*/ | ||
public class ReverseProxyUserDetails implements UserDetails { | ||
|
||
private static final long serialVersionUID = 8070729070782792157L; | ||
|
||
private static Attributes attributes = new BasicAttributes(); | ||
private static final Attributes attributes = new BasicAttributes(); | ||
|
||
@CheckForNull | ||
private GrantedAuthority[] authorities; | ||
@CheckForNull | ||
private String username; | ||
|
||
@CheckForNull | ||
@SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "We keep it as is due to performance reasons") | ||
public GrantedAuthority[] getAuthorities() { | ||
return authorities; | ||
} | ||
|
||
public void setAuthorities(GrantedAuthority[] authorities) { | ||
this.authorities = authorities; | ||
public void setAuthorities(@CheckForNull GrantedAuthority[] authorities) { | ||
this.authorities = authorities != null ? Arrays.copyOf(authorities, authorities.length) : null; | ||
} | ||
|
||
public String getPassword() { | ||
return ""; | ||
} | ||
|
||
@CheckForNull | ||
public String getUsername() { | ||
return username; | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a runtime exception, which is declared by
loadUserByUsername()