parent
3b1c1ac85f
commit
e9569564d7
|
|
@ -28,6 +28,14 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.4</version>
|
||||
<type>jar</type>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ package org.jasig.cas.client;
|
|||
import java.io.*;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Scott Battaglia
|
||||
|
|
@ -42,6 +44,8 @@ public final class PublicTestHttpServer extends Thread {
|
|||
|
||||
private ServerSocket server;
|
||||
|
||||
private static Map<Integer, PublicTestHttpServer> serverMap = new HashMap<Integer, PublicTestHttpServer>();
|
||||
|
||||
private PublicTestHttpServer(String data, String encoding, String MIMEType, int port) throws UnsupportedEncodingException {
|
||||
this(data.getBytes(encoding), encoding, MIMEType, port);
|
||||
}
|
||||
|
|
@ -55,9 +59,14 @@ public final class PublicTestHttpServer extends Thread {
|
|||
}
|
||||
|
||||
public static synchronized PublicTestHttpServer instance(final int port) {
|
||||
if (serverMap.containsKey(port)) {
|
||||
return serverMap.get(port);
|
||||
}
|
||||
|
||||
try {
|
||||
final PublicTestHttpServer server = new PublicTestHttpServer("test", "ASCII", "text/plain", port);
|
||||
server.start();
|
||||
serverMap.put(port, server);
|
||||
Thread.yield();
|
||||
return server;
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ public class CasLoginModuleTests {
|
|||
|
||||
private Map<String,String> options;
|
||||
|
||||
@AfterClass
|
||||
/* @AfterClass
|
||||
public static void classCleanUp() {
|
||||
server.shutdown();
|
||||
}
|
||||
}*/
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ public final class Cas10TicketValidatorTests extends AbstractTicketValidatorTest
|
|||
super();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
/*@AfterClass
|
||||
public static void classCleanUp() {
|
||||
server.shutdown();
|
||||
}
|
||||
} */
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ public final class Cas20ProxyTicketValidatorTests extends AbstractTicketValidato
|
|||
super();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
/*@AfterClass
|
||||
public static void classCleanUp() {
|
||||
server.shutdown();
|
||||
}
|
||||
} */
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ public final class Cas20ServiceTicketValidatorTests extends AbstractTicketValida
|
|||
super();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
/*@AfterClass
|
||||
public static void classCleanUp() {
|
||||
server.shutdown();
|
||||
}
|
||||
} */
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ public final class Saml11TicketValidatorTests extends AbstractTicketValidatorTes
|
|||
this.validator.setTolerance(1000L);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
/*@AfterClass
|
||||
public static void cleanUp() throws Exception {
|
||||
server.shutdown();
|
||||
}
|
||||
}*/
|
||||
|
||||
@Test
|
||||
public void testValidationFailedResponse() throws UnsupportedEncodingException {
|
||||
|
|
|
|||
|
|
@ -14,17 +14,28 @@
|
|||
<dependency>
|
||||
<artifactId>atlassian-seraph</artifactId>
|
||||
<groupId>com.atlassian.seraph</groupId>
|
||||
<version>2.3.3</version>
|
||||
<version>2.4.0</version>
|
||||
<scope>provided</scope>
|
||||
<type>jar</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>opensymphony</groupId>
|
||||
<artifactId>propertyset</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<optional>true</optional>
|
||||
<!-- https://maven.atlassian.com/content/groups/m1/com.atlassian.seraph/jars/ -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>atlassian-osuser</artifactId>
|
||||
<groupId>com.atlassian.osuser</groupId>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
<type>jar</type>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- https://maven.atlassian.com/content/groups/m1/com.atlassian.confluence/jars/ -->
|
||||
<groupId>com.atlassian.confluence</groupId>
|
||||
|
|
@ -513,7 +524,8 @@
|
|||
|
||||
</dependencies>
|
||||
|
||||
<!--
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>atlassian</id>
|
||||
|
|
@ -521,5 +533,6 @@
|
|||
<url>http://repository.atlassian.com/maven2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
-->
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ package org.jasig.cas.client.integration.atlassian;
|
|||
|
||||
import com.atlassian.seraph.auth.DefaultAuthenticator;
|
||||
import com.atlassian.seraph.auth.AuthenticatorException;
|
||||
import com.opensymphony.user.EntityNotFoundException;
|
||||
import com.opensymphony.user.User;
|
||||
import com.opensymphony.user.UserManager;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
|
|
@ -47,6 +50,21 @@ public final class JiraCasAuthenticator extends DefaultAuthenticator {
|
|||
|
||||
private static final Log LOG = LogFactory.getLog(JiraCasAuthenticator.class);
|
||||
|
||||
@Override
|
||||
protected boolean authenticate(final Principal principal, final String password) throws AuthenticatorException {
|
||||
return ((User) principal).authenticate(password);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Principal getUser(final String username) {
|
||||
try {
|
||||
return UserManager.getInstance().getUser(username);
|
||||
} catch (final EntityNotFoundException e) {
|
||||
LOG.warn("Could not find user '" + username + "' in UserManager : " + e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) {
|
||||
final HttpSession session = request.getSession();
|
||||
|
||||
|
|
|
|||
3
pom.xml
3
pom.xml
|
|
@ -64,6 +64,7 @@
|
|||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
@ -72,6 +73,8 @@
|
|||
<includes>
|
||||
<include>**/*Tests*</include>
|
||||
</includes>
|
||||
<useUnlimitedThreads>false</useUnlimitedThreads>
|
||||
<threadCount>1</threadCount>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
|
|
|
|||
Loading…
Reference in New Issue