Skip to content

Commit

Permalink
Ref: deepy#25
Browse files Browse the repository at this point in the history
Added javax.xml.bind:jaxb-api:2.3.0, javax.activation:activation:1.1, com.sun.xml.bind:jaxb-core:2.3.0 and org.glassfish.jaxb:jaxb-runtime:2.3.0 dependencies.
Forced the thread context loader (use when authenticating) to use the plugin context loader.
  • Loading branch information
vai-frd committed Jul 8, 2019
1 parent 760bc07 commit 38a7bdd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
24 changes: 23 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
</issueManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.version>6.7</sonar.version>
<sonar.pluginName>Crowd</sonar.pluginName>
<sonar.pluginClass>org.sonar.plugins.crowd.CrowdPlugin</sonar.pluginClass>
Expand Down Expand Up @@ -91,6 +92,26 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<!-- unit tests -->
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
Expand Down Expand Up @@ -118,12 +139,13 @@
<url>https://packages.atlassian.com/maven-public-legacy-local</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/sonar/plugins/crowd/CrowdRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public void init() {
this.authenticator = new CrowdAuthenticator(crowdClient);
this.usersProvider = new CrowdUsersProvider(crowdClient);
this.groupsProvider = new CrowdGroupsProvider(crowdClient);
// Had to add that as from "not really a good idea" in https://stackoverflow.com/questions/51518781/jaxb-not-available-on-tomcat-9-and-java-9-10
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
crowdClient.testConnection();
LOG.info("Crowd configuration is valid, connection test successful.");
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/sonar/plugins/crowd/CrowdUsersProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public CrowdUsersProvider(CrowdClient crowdClient) {
@Override
public UserDetails doGetUserDetails(String username) {
LOG.debug("Looking up user details for user {}", username);
// Had to add that as from "not really a good idea" in https://stackoverflow.com/questions/51518781/jaxb-not-available-on-tomcat-9-and-java-9-10
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());

try {
User user = crowdClient.getUser(username);
Expand Down

0 comments on commit 38a7bdd

Please sign in to comment.