Merge pull request #2357 from stianst/master

Fixes
This commit is contained in:
Stian Thorgersen 2016-03-10 08:08:09 +01:00
commit b9fea7b143
2 changed files with 29 additions and 18 deletions

View file

@ -364,7 +364,7 @@ $ java -jar bin/launcher.jar [your-config.json]
OIDC identity token it received for authentication.
<variablelist>
<varlistentry>
<term>KEYCLOAK-SUBJECT</term>
<term>KEYCLOAK_SUBJECT</term>
<listitem>
<para>
User id. Corresponds to JWT <literal>sub</literal> and will be the user id Keycloak uses to store
@ -373,7 +373,7 @@ $ java -jar bin/launcher.jar [your-config.json]
</listitem>
</varlistentry>
<varlistentry>
<term>KEYCLOAK-USERNAME</term>
<term>KEYCLOAK_USERNAME</term>
<listitem>
<para>
Username. Corresponds to JWT <literal>preferred_username</literal>
@ -381,7 +381,7 @@ $ java -jar bin/launcher.jar [your-config.json]
</listitem>
</varlistentry>
<varlistentry>
<term>KEYCLOAK-EMAIL</term>
<term>KEYCLOAK_EMAIL</term>
<listitem>
<para>
Email address of user if set.
@ -389,7 +389,7 @@ $ java -jar bin/launcher.jar [your-config.json]
</listitem>
</varlistentry>
<varlistentry>
<term>KEYCLOAK-NAME</term>
<term>KEYCLOAK_NAME</term>
<listitem>
<para>
Full name of user if set.
@ -397,7 +397,7 @@ $ java -jar bin/launcher.jar [your-config.json]
</listitem>
</varlistentry>
<varlistentry>
<term>KEYCLOAK-ACCESS-TOKEN</term>
<term>KEYCLOAK_ACCESS_TOKEN</term>
<listitem>
<para>
Send the access token in this header if the proxy was configured to send it. This token can
@ -410,7 +410,7 @@ $ java -jar bin/launcher.jar [your-config.json]
<programlisting><![CDATA[
{
"header-names" {
"keycloak-subject": "MY-SUBJECT"
"keycloak-subject": "MY_SUBJECT"
}
}
]]></programlisting>

View file

@ -1,9 +1,10 @@
package org.keycloak.testsuite.util;
import org.apache.commons.io.FileUtils;
import org.jboss.logging.Logger;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.jboss.logging.Logger;
/**
*
@ -14,21 +15,31 @@ public class LogChecker {
private static final Logger log = Logger.getLogger(LogChecker.class);
private static final String[] IGNORED = new String[] { ".*Jetty ALPN support not found.*" };
public static void checkServerLog(File logFile) throws IOException {
log.info(String.format("Checking server log: '%s'", logFile.getAbsolutePath()));
String logContent = FileUtils.readFileToString(logFile);
boolean containsError
= logContent.contains("ERROR")
|| logContent.contains("SEVERE")
|| logContent.contains("Exception ");
String[] logContent = FileUtils.readFileToString(logFile).split("\n");
for (String log : logContent) {
boolean containsError = log.contains("ERROR") || log.contains("SEVERE") || log.contains("Exception ");
//There is expected string "Exception" in server log: Adding provider
//singleton org.keycloak.services.resources.ModelExceptionMapper
if (containsError) {
throw new RuntimeException(String.format("Server log file contains ERROR: '%s'", logFile.getPath()));
boolean ignore = false;
for (String i : IGNORED) {
if (log.matches(i)) {
ignore = true;
break;
}
}
if (!ignore) {
throw new RuntimeException(String.format("Server log file contains ERROR: '%s'", log));
}
}
}
}
public static void checkJBossServerLog(String jbossHome) throws IOException {
checkServerLog(new File(jbossHome + "/standalone/log/server.log"));