This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rest-foo-bak
Conflicts: console/src/main/scripts/bower.json console/src/main/scripts/package.json dist/pom.xml dist/src/main/resources/wildfly/patches/standalone.xsl pom.xml
- Loading branch information
Showing
105 changed files
with
1,470 additions
and
23,876 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
console/src/main/java/org/hawkular/console/configuration/KeycloakConfigurationServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.hawkular.console.configuration; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.io.PrintWriter; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
/** | ||
* @author Juraci Paixão Kröhling | ||
*/ | ||
@WebServlet("/keycloak.json") | ||
public class KeycloakConfigurationServlet extends HttpServlet { | ||
private static final Pattern PROPERTY_REPLACEMENT_PATTERN = Pattern.compile("\\$\\{([^}]*)\\}"); | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | ||
resp.setContentType("application/json"); | ||
PrintWriter writer = resp.getWriter(); | ||
writer.println(getKeycloakJson()); | ||
writer.close(); | ||
} | ||
|
||
private String getKeycloakJson() throws IOException { | ||
String rawKeycloakJson = getRawKeycloakJson(); | ||
Matcher matcher = PROPERTY_REPLACEMENT_PATTERN.matcher(rawKeycloakJson); | ||
while(matcher.find()) { | ||
String propertyNotation = matcher.group(); | ||
String propertyName = matcher.group(1); | ||
String value = System.getProperty(propertyName); | ||
if (null == value || value.isEmpty()) { | ||
value = propertyNotation; | ||
} | ||
rawKeycloakJson = rawKeycloakJson.replaceFirst( | ||
Pattern.quote(propertyNotation), | ||
Matcher.quoteReplacement(value) | ||
); | ||
} | ||
|
||
return rawKeycloakJson; | ||
} | ||
|
||
private String getRawKeycloakJson() throws IOException { | ||
InputStream keycloakJson = getClass().getResourceAsStream("/keycloak.json"); | ||
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(keycloakJson))) { | ||
return buffer.lines().collect(Collectors.joining("\n")); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...in/scripts/plugins/accounts/keycloak.json → console/src/main/resources/keycloak.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
console/src/main/scripts/plugins/accessPortal/html/my_cases.html
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
console/src/main/scripts/plugins/accessPortal/html/open_case.html
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
console/src/main/scripts/plugins/accessPortal/html/search.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
console/src/main/scripts/plugins/accessPortal/less/accessPortal.less
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
console/src/main/scripts/plugins/accessPortal/ts/accessPortalGlobals.ts
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
console/src/main/scripts/plugins/accessPortal/ts/accessPortalPlugin.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.