forked from dbarentine/keycloak-wsfed
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLOUDTRUST-2708] Add install.sh and fix some Sonar code smells
- Loading branch information
Showing
65 changed files
with
1,801 additions
and
960 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,46 @@ for its operations. | |
|
||
This module is currently working on 8.0.1 (check tags for compatibility with previous Keycloak versions) | ||
|
||
## How to Install | ||
## How to build | ||
|
||
Before building this project with a basic `mvn clean install`, you need to first build cloudtrust-common. | ||
|
||
```Bash | ||
git clone [email protected]:cloudtrust/cloudtrust-parent.git | ||
cd cloudtrust-parent | ||
mvn clean install | ||
``` | ||
|
||
Then build keycloak-wsfed: | ||
|
||
```Bash | ||
git clone [email protected]:cloudtrust/keycloak-wsfed.git | ||
cd keycloak-wsfed | ||
mvn clean install | ||
``` | ||
|
||
If you get an error telling `Could not find artifact org.keycloak.testsuite:integration-arquillian-tests:pom`, you might build Keycloak with: | ||
|
||
```Bash | ||
mvn install -Pconsole-ui-tests -DskipTests | ||
``` | ||
|
||
|
||
## How to install | ||
|
||
After building it, you can automatically install this module using the following command line: | ||
|
||
```Bash | ||
./keycloak-wsfed/install.sh {path-to-keycloak} | ||
``` | ||
|
||
You can uninstall it with: | ||
|
||
```Bash | ||
./keycloak-wsfed/install.sh {path-to-keycloak} -u | ||
``` | ||
|
||
But you can choose to manually install it: | ||
|
||
### Copy files | ||
|
||
|
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
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
53 changes: 53 additions & 0 deletions
53
...wsfed-tests/src/test/java/com/quest/keycloak/common/wsfed/parsers/AbstractParserTest.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,53 @@ | ||
package com.quest.keycloak.common.wsfed.parsers; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.function.Function; | ||
|
||
import javax.xml.stream.XMLEventReader; | ||
|
||
import org.picketlink.common.exceptions.ParsingException; | ||
import org.picketlink.common.util.StaxParserUtil; | ||
|
||
public abstract class AbstractParserTest { | ||
@SuppressWarnings({ "unchecked" }) | ||
protected <T> T parseFile(String filename, Class<T> clazz, Function<String, String>... updaters) throws ParsingException, IOException { | ||
return clazz.cast(new WSTrustParser().parse(getXMLEventReader(filename, updaters))); | ||
} | ||
|
||
protected InputStream getInputStream(String filename) { | ||
InputStream stream = WSTRequestSecurityTokenResponseCollectionParserTest.class.getResourceAsStream(filename); | ||
if (stream==null) { | ||
try { | ||
stream = new FileInputStream("src/test/resources"+filename); | ||
} catch (IOException e) { | ||
// Ignore | ||
} | ||
} | ||
return stream; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
protected XMLEventReader getXMLEventReader(String filename, Function<String, String>... updaters) throws IOException { | ||
if (updaters==null) { | ||
return StaxParserUtil.getXMLEventReader(getInputStream(filename)); | ||
} | ||
String xml; | ||
try (InputStream input = getInputStream(filename)) { | ||
byte[] content = new byte[input.available()]; | ||
input.read(content); | ||
xml = new String(content, StandardCharsets.UTF_8); | ||
} | ||
if (updaters!=null) { | ||
for(Function<String, String> updater : updaters) { | ||
xml = updater.apply(xml); | ||
} | ||
} | ||
try (InputStream stream = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))) { | ||
return StaxParserUtil.getXMLEventReader(stream); | ||
} | ||
} | ||
} |
Oops, something went wrong.