Skip to content

Instantly share code, notes, and snippets.

@precurse
Created May 12, 2017 19:58
Show Gist options
  • Save precurse/f24aef17920dac9a1d885b580bb40e2c to your computer and use it in GitHub Desktop.
Save precurse/f24aef17920dac9a1d885b580bb40e2c to your computer and use it in GitHub Desktop.
Patches for OpenConext dashboard
Listen {{ apache_app_listen_address.dashboard }}:{{ loadbalancing.dashboard.port }}
<VirtualHost {{ apache_app_listen_address.dashboard }}:{{ loadbalancing.dashboard.port }}>
ServerName https://dashboard.{{ base_domain }}
ErrorLog "|/usr/bin/logger -p local3.err -t 'Apache-Dashboard'"
CustomLog "|/usr/bin/logger -p local3.info -t 'Apache-Dashboard'" combined
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.html$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !\.svg$
RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.png$
RewriteCond %{REQUEST_URI} !\.ico$
RewriteCond %{REQUEST_URI} !\.woff$
RewriteCond %{REQUEST_URI} !\.woff2$
RewriteCond %{REQUEST_URI} !\.ttf$
RewriteCond %{REQUEST_URI} !\.eot$
RewriteCond %{REQUEST_URI} !dashboard
RewriteCond %{REQUEST_URI} !fonts
RewriteRule (.*) /index.html [L] RewriteRule (.*) /index.html [L]
ProxyPassMatch .*\.js !
ProxyPassMatch .*\.html !
ProxyPassMatch .*\.css !
ProxyPassMatch .*\.png !
ProxyPassMatch .*\.ttf !
ProxyPassMatch .*\.woff !
ProxyPass /Shibboleth.sso !
ProxyPass {{ js_error_reporting_url }} http://localhost:{{ springapp_tcpport_error_handling }}/jsError retry=0
ProxyPass / http://localhost:{{ springapp_tcpport }}/ retry=0
ProxyPassReverse / http://localhost:{{ springapp_tcpport }}/
DocumentRoot /var/www/dashboard/current
<Directory /var/www/dashboard/current>
Order allow,deny
Allow from all
Options -Indexes
</Directory>
# Enable shibboleth for all other URLs, but the health check and EB endpoint
<Location ~ "/dashboard/api/(protected/*|decide/policy|health|info)">
allow from all
satisfy any
</Location>
<Location ~ "(.*)(js|css|png)$">
allow from all
satisfy any
</Location>
<Location />
AuthType shibboleth
ShibUseHeaders On
ShibRequestSetting applicationId dashboard
ShibRequireSession On
require valid-user
</Location>
{% if haproxy_backend_tls %}
SSLEngine on
SSLCertificateFile {{ tls.cert_path }}/backend.{{ base_domain }}.pem
SSLCertificateKeyFile {{ tls.cert_private_path }}/backend.{{ base_domain }}.key
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder on
SSLCompression off
{% endif %}
</VirtualHost>
diff --git a/selfservice/src/main/java/selfservice/Application.java b/selfservice/src/main/java/selfservice/Application.java
index 411a459..d330df8 100644
--- a/selfservice/src/main/java/selfservice/Application.java
+++ b/selfservice/src/main/java/selfservice/Application.java
@@ -86,7 +86,7 @@ public class Application extends SpringBootServletInitializer {
}
@Bean
- @Profile("!dev")
+ @Profile("dev")
public VootClient vootClient(Environment environment,
@Value("${voot.accessTokenUri}") String accessTokenUri,
@Value("${voot.clientId}") String clientId,
@@ -97,7 +97,7 @@ public class Application extends SpringBootServletInitializer {
}
@Bean
- @Profile("dev")
+ @Profile("!dev")
public VootClient mockVootClient(Environment environment) {
return new VootClientMock();
}
diff --git a/dashboard/src/javascripts/index.jsx b/dashboard/src/javascripts/index.jsx
index c891adc..5f8b8df 100644
--- a/dashboard/src/javascripts/index.jsx
+++ b/dashboard/src/javascripts/index.jsx
@@ -105,11 +105,11 @@ if (browserSupported()) {
const locationHash = window.location.hash.substr(1);
currentUser.statsToken = locationHash.substr(locationHash.indexOf("access_token=")).split("&")[0].split("=")[1];
- if (!currentUser.statsToken) {
- window.location = currentUser.statsUrl + "&state=" + window.location;
- } else {
+ //if (!currentUser.statsToken) {
+ // window.location = currentUser.statsUrl + "&state=" + window.location;
+ //} else {
render(<App currentUser={currentUser} />, document.getElementById("app"));
- }
+ //}
});
} else {
render(<BrowserNotSupported />, document.getElementById("app"));
diff --git a/selfservice/pom.xml b/selfservice/pom.xml
index 2ff9332..cde5505 100644
--- a/selfservice/pom.xml
+++ b/selfservice/pom.xml
@@ -23,7 +23,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>selfservice</artifactId>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>OpenConext : selfservice</name>
<properties>
diff --git a/selfservice/src/main/java/selfservice/service/impl/VootClientMock.java b/selfservice/src/main/java/selfservice/service/impl/VootClientMock.java
index 95d4ce8..b1e34ee 100644
--- a/selfservice/src/main/java/selfservice/service/impl/VootClientMock.java
+++ b/selfservice/src/main/java/selfservice/service/impl/VootClientMock.java
@@ -14,20 +14,20 @@ public class VootClientMock implements VootClient {
@Override
public boolean hasAccess(String personId, String groupId) {
- return personId.endsWith(CSA_ADMIN);
+ return true;
}
@Override
public List<Group> groups(final String userId) {
switch (userId) {
case "super":
- return asList(new Group("dashboard.super.user"));
+ return asList(new Group("dashboard.admin"));
case "admin":
return asList(new Group("dashboard.admin"));
case "viewer":
- return asList(new Group("dashboard.viewer"));
+ return asList(new Group("dashboard.admin"));
default:
- return Collections.emptyList();
+ return asList(new Group("dashboard.admin"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment