Skip to content

Commit

Permalink
Allow for DB down
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Aug 27, 2024
1 parent 6548a50 commit 6ba0f95
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion manage-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>manage</artifactId>
<version>7.4.6</version>
<version>7.4.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion manage-gui/src/components/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class Navigation extends React.PureComponent {
{this.renderItem("/staging", "staging", openChangeRequestsCount === 0 ? null : openChangeRequestsCount)}
{this.renderItem("/scopes", "scopes")}
{this.renderItem("/activity", "activity")}
{this.renderItem("/policies", "policies")}
{currentUser.push.pdpEnabled && this.renderItem("/policies", "policies")}
{this.renderSpinner()}
{this.renderPushButton()}
</div>
Expand Down
2 changes: 1 addition & 1 deletion manage-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>manage</artifactId>
<version>7.4.6</version>
<version>7.4.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 3 additions & 1 deletion manage-server/src/main/java/manage/conf/Push.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ public class Push implements Serializable {
public final String pdpUrl;
public final String pdpName;
public final boolean excludeOidcRP;
public final boolean pdpEnabled;

public Push(String url, String name, String oidcUrl, String oidcName, String pdpUrl, String pdpName, boolean excludeOidcRP) {
public Push(String url, String name, String oidcUrl, String oidcName, String pdpUrl, String pdpName, boolean excludeOidcRP, boolean pdpEnabled) {
this.url = url.replaceFirst("://(.*)@", "://");
this.name = name;
this.oidcName = oidcName;
this.oidcUrl = oidcUrl;
this.pdpUrl = pdpUrl;
this.pdpName = pdpName;
this.excludeOidcRP = excludeOidcRP;
this.pdpEnabled = pdpEnabled;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public class DatabaseController {
this.excludeOidcRP = excludeOidcRP;
this.excludeSRAM = excludeSRAM;

this.oidcRestTemplate = new RestTemplate(getRequestFactory(oidcUser, oidcPassword,oidcPushUri ));
this.oidcRestTemplate = oidcEnabled ? new RestTemplate(getRequestFactory(oidcUser, oidcPassword,oidcPushUri )) : null;
this.oidcPushUri = oidcPushUri;
this.oidcEnabled = oidcEnabled;

this.pdpRestTemplate = new RestTemplate(getRequestFactory(pdpUser, pdpPassword, pdpPushUri));
this.pdpRestTemplate = pdpEnabled ? new RestTemplate(getRequestFactory(pdpUser, pdpPassword, pdpPushUri)) : null;
this.pdpPushUri = pdpPushUri;
this.pdpEnabled = pdpEnabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public static class InternalSecurityConfigurationAdapter extends WebSecurityConf
@Value("${push.pdp.url}")
private String pdpPushUri;

@Value("${push.pdp.enabled}")
private boolean pdpEnabled;

@Value("${push.pdp.name}")
private String pdpName;

Expand All @@ -133,7 +136,7 @@ protected void configure(HttpSecurity http) throws Exception {
.collect(toList());

Product product = new Product(productOrganization, productName, serviceProviderFeedUrl, showOidcRp);
Push push = new Push(pushUrl, pushName, pushOidcUrl, pushOidcName, pdpPushUri,pdpName, excludeOidcRP);
Push push = new Push(pushUrl, pushName, pushOidcUrl, pushOidcName, pdpPushUri,pdpName, excludeOidcRP, pdpEnabled);

BasicAuthenticationEntryPoint authenticationEntryPoint = new BasicAuthenticationEntryPoint();
authenticationEntryPoint.setRealmName("manage");
Expand Down
10 changes: 8 additions & 2 deletions manage-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ push:
user: pdp_admin
name: OpenConext PDP
password: secret
enabled: True
enabled: true

product:
name: Manage
Expand Down Expand Up @@ -89,7 +89,11 @@ spring:
username: root
password:
driverClassName: org.mariadb.jdbc.Driver

jpa:
database-platform: org.hibernate.dialect.MariaDB53Dialect
sql:
init:
continue-on-error: true
main:
banner-mode: "off"

Expand All @@ -105,6 +109,8 @@ management:
enabled: false
mongo:
enabled: true
db:
enabled: false
endpoints:
web:
exposure:
Expand Down
2 changes: 1 addition & 1 deletion manage-server/src/test/java/manage/conf/PushTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PushTest {
@Test
public void testUserNamePasswordRemoval() {
Push push = new Push("https://serviceregistry:[email protected]/api/connections",
"name", "oidcUrl", "oidcName", "pdpUrl", "pdpName", true);
"name", "oidcUrl", "oidcName", "pdpUrl", "pdpName", true, true);
assertEquals("https://engine-api.test2.surfconext.nl/api/connections", push.url);
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.openconext</groupId>
<artifactId>manage</artifactId>
<version>7.4.6</version>
<version>7.4.7</version>
<packaging>pom</packaging>

<name>manage</name>
Expand Down

0 comments on commit 6ba0f95

Please sign in to comment.