Skip to content

Commit

Permalink
* Fixes Redirection Issue #1
Browse files Browse the repository at this point in the history
* Also added missing pom.xml from earlier commit.
* updated package structure
  • Loading branch information
rkadam committed Sep 22, 2016
1 parent 98b2530 commit c5ed7b1
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 6 deletions.
113 changes: 113 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>bitbucket</groupId>
<artifactId>saml.plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<organization>
<name></name>
<url>https://github.com/rkadam/bitbucket-saml-plugin</url>
</organization>
<name>bitbucket-saml-plugin</name>
<description>SAML Connector for Bitbucket Server to make it work with SSO / IDPs</description>
<packaging>atlassian-plugin</packaging>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>com.lastpass</groupId>
<artifactId>saml-sdk-java</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-api</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-spi</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-page-objects</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>bitbucket-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<products>
<product>
<id>bitbucket</id>
<instanceId>bitbucket</instanceId>
<version>${bitbucket.version}</version>
<dataVersion>${bitbucket.data.version}</dataVersion>
</product>
</products>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<jdk.level>1.8</jdk.level>
<bitbucket.version>4.9.1</bitbucket.version>
<bitbucket.data.version>4.9.1</bitbucket.data.version>
<amps.version>6.2.2</amps.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pandora.bitbucket.auth;
package team.effort.bitbucket.auth;

import com.lastpass.saml.SAMLInit;
import com.lastpass.saml.SAMLClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pandora.bitbucket.auth;
package team.effort.bitbucket.auth;

import java.io.IOException;
import java.net.URI;
Expand All @@ -19,7 +19,7 @@
import com.atlassian.bitbucket.i18n.I18nService;
import com.atlassian.bitbucket.user.UserService;

import com.pandora.bitbucket.auth.BitbucketSAMLHandler;
import team.effort.bitbucket.auth.BitbucketSAMLHandler;

public class BitbucketSAMLLoginFilter implements Filter {

Expand All @@ -46,8 +46,8 @@ public void doFilter(ServletRequest request, ServletResponse response,

if (idpRequired == true) {
try {
String url = new BitbucketSAMLHandler(i18nService, userService).getRedirectUrl(request.getParameter("os_destination"));
log.debug("saml_login: redirecting user to " + url);
String url = new BitbucketSAMLHandler(i18nService, userService).getRedirectUrl(request.getParameter("next"));
log.debug("saml_login -> User trying to access URL - " + url);
res.sendRedirect(res.encodeRedirectURL(url));
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pandora.bitbucket.auth;
package team.effort.bitbucket.auth;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -44,6 +44,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
// great, go back to wherever we started.
//request.setAttribute("loggedInUser", jiraAuthenticationContext.getLoggedInUser() == null ? null : jiraAuthenticationContext.getLoggedInUser().getDisplayName());
String originalUrl = request.getParameter("RelayState");
log.debug("Original URL from RelayState - " + originalUrl);
if (originalUrl == null)
originalUrl = "/";

Expand Down

0 comments on commit c5ed7b1

Please sign in to comment.