local testing without cas and https

This commit is contained in:
Peter Hormanns 2012-07-26 16:57:17 +00:00
parent dec7a70e42
commit efe1dca0df
2 changed files with 17 additions and 4 deletions

View File

@ -32,12 +32,19 @@ public class CASTicket {
this.user = user; this.user = user;
this.runAs = runAs; this.runAs = runAs;
Config config = Config.getInstance(); Config config = Config.getInstance();
loginURL = config.getProperty("loginURL", LOGIN_URL);
backendURL = config.getProperty("backendURL", BACKEND_URL); backendURL = config.getProperty("backendURL", BACKEND_URL);
grantingTicket = readFiledGrantingTicket(); loginURL = config.getProperty("loginURL", LOGIN_URL);
if ("TestUmgebung".equals(loginURL)) {
grantingTicket = "ticket:" + user;
} else {
grantingTicket = readFiledGrantingTicket();
}
} }
public String getTicket() throws JSCliException { public String getTicket() throws JSCliException {
if (grantingTicket != null && grantingTicket.startsWith("ticket:")) {
return grantingTicket.replaceFirst("ticket", "user");
}
try { try {
String encodedParams = URLEncoder.encode("service", "UTF-8") String encodedParams = URLEncoder.encode("service", "UTF-8")
+ "=" + URLEncoder.encode(backendURL, "UTF-8"); + "=" + URLEncoder.encode(backendURL, "UTF-8");

View File

@ -38,6 +38,9 @@ public class Main {
throw new JSCliException("fatal error: console not found"); throw new JSCliException("fatal error: console not found");
} }
String command = console.readLine("%s@hsadmin>", runAs); String command = console.readLine("%s@hsadmin>", runAs);
if (command == null) {
command = "";
}
while (!("bye".equals(command.trim()) || "exit".equals(command.trim()) || "quit".equals(command.trim()))) { while (!("bye".equals(command.trim()) || "exit".equals(command.trim()) || "quit".equals(command.trim()))) {
try { try {
console.printf("%s\n", formatter.format(scriptClient.execute(command))); console.printf("%s\n", formatter.format(scriptClient.execute(command)));
@ -45,9 +48,12 @@ public class Main {
console.printf("ERR: %s\n", e.getLocalizedMessage()); console.printf("ERR: %s\n", e.getLocalizedMessage());
} }
command = console.readLine("%s@hsadmin>", runAs); command = console.readLine("%s@hsadmin>", runAs);
while (command.endsWith("\\")) { if (command == null) {
command = "";
}
while (command.trim().endsWith("\\")) {
command = command.substring(0, command.length() - 1) + command = command.substring(0, command.length() - 1) +
console.readLine(">"); "\n" + console.readLine(">");
} }
} }
} }