Bazel: Rename plugin name to saml
This also requires changing the SAML2 callback from:
plugins/gerrit-saml-plugin/saml
to
plugins/saml/callback
Change-Id: Icdf56c9fa24abdf85b460c346629c2596c2d4ffb
diff --git a/BUILD b/BUILD
index 5eff3a6..7786b50 100644
--- a/BUILD
+++ b/BUILD
@@ -4,7 +4,7 @@
name = "saml",
srcs = glob(["src/main/java/**/*.java"]),
manifest_entries = [
- "Gerrit-PluginName: gerrit-saml-plugin",
+ "Gerrit-PluginName: saml",
],
resources = glob(["src/main/resources/**"]),
deps = [
diff --git a/README.md b/README.md
index 5c131be..be8b051 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,9 @@
- Create a new SAML 2.0 application.
- Set the following parameters:
- - Single sign on URL: http://gerrit.site.com/plugins/gerrit-saml-plugin/saml
+ - Single sign on URL: http://gerrit.site.com/plugins/saml/callback
- Check "Use this for Recipient URL and Destination URL".
- - Audience URI (SP Entity Id): http://gerrit.site.com/plugins/gerrit-saml-plugin/saml
+ - Audience URI (SP Entity Id): http://gerrit.site.com/plugins/saml/callback
- We need to set up the attributes in the assertion to send the right
information. Here is how to do it with Okta:
- Application username: "Okta username prefix"
@@ -36,7 +36,7 @@
- Obtain your IdP metadata (either URL or a local XML file)
If you are using Active Directory Federation Services (ADFS), follow the below steps to configure Gerrit.
-You can then [go here](doc/Setup_ADFS.md) for more details on howto make gerrit-saml-plugin work with ADFS.
+You can then [go here](doc/Setup_ADFS.md) for more details on how to make the saml plugin work with ADFS.
### Download the plugin
diff --git a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
index 2384973..30ab256 100644
--- a/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
+++ b/src/main/java/com/thesamet/gerrit/plugins/saml/SamlWebFilter.java
@@ -54,7 +54,8 @@
private static final String GERRIT_LOGOUT = "/logout";
private static final String GERRIT_LOGIN = "/login";
- private static final String SAML_POSTBACK = "/plugins/gerrit-saml-plugin/saml";
+ private static final String SAML = "saml";
+ private static final String SAML_CALLBACK = "plugins/" + SAML + "/callback";
private static final String SESSION_ATTR_USER = "Gerrit-Saml-User";
private final SAML2Client saml2Client;
@@ -75,9 +76,7 @@
samlConfig.getPrivateKeyPassword(), samlConfig.getMetadataPath());
samlClientConfig.setMaximumAuthenticationLifetime(samlConfig.getMaxAuthLifetimeAttr());
saml2Client = new SAML2Client(samlClientConfig);
- String callbackUrl =
- gerritConfig.getString("gerrit", null, "canonicalWebUrl")
- + "plugins/gerrit-saml-plugin/saml";
+ String callbackUrl = gerritConfig.getString("gerrit", null, "canonicalWebUrl") + SAML_CALLBACK;
httpUserNameHeader = getHeaderFromConfig(gerritConfig, "httpHeader");
httpDisplaynameHeader = getHeaderFromConfig(gerritConfig, "httpDisplaynameHeader");
httpEmailHeader = getHeaderFromConfig(gerritConfig, "httpEmailHeader");
@@ -165,7 +164,7 @@
getUserName(user),
getDisplayName(user),
getEmailAddress(user),
- "saml/" + user.getId()));
+ String.format("%s/%s", SAML, user.getId())));
String redirectUri = context.getRequest().getParameter("RelayState");
if (null == redirectUri || redirectUri.isEmpty()) {
@@ -204,7 +203,7 @@
private static boolean isSamlPostback(HttpServletRequest request) {
return "POST".equals(request.getMethod())
- && request.getRequestURI().indexOf(SAML_POSTBACK) >= 0;
+ && request.getRequestURI().indexOf(SAML_CALLBACK) >= 0;
}
private static String getAttribute(SAML2Profile user, String attrName) {