diff options
| author | Simon Rettberg | 2015-07-08 19:39:35 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2015-07-08 19:39:35 +0200 |
| commit | 8d6cd17c330388aa13fd7c39802c7400d85f972c (patch) | |
| tree | 5f2c5856f58b1454e24dc16fad10751dfe9d087b /dozentenmodul/src/main/java/util | |
| parent | oops (diff) | |
| download | tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.gz tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.tar.xz tutor-module-8d6cd17c330388aa13fd7c39802c7400d85f972c.zip | |
[client] Redo package structure, add comments/TODOs, rename GUI classes
Diffstat (limited to 'dozentenmodul/src/main/java/util')
| -rw-r--r-- | dozentenmodul/src/main/java/util/CheckIntegrity.java | 121 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/FormatHelper.java | 35 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/MessageType.java | 23 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/News.java | 236 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/OpenLinks.java | 82 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/ResourceLoader.java | 96 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/ServiceProviderResponse.java | 15 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/util/ShibbolethECP.java | 172 |
8 files changed, 0 insertions, 780 deletions
diff --git a/dozentenmodul/src/main/java/util/CheckIntegrity.java b/dozentenmodul/src/main/java/util/CheckIntegrity.java deleted file mode 100644 index faded054..00000000 --- a/dozentenmodul/src/main/java/util/CheckIntegrity.java +++ /dev/null @@ -1,121 +0,0 @@ -package util; - -public class CheckIntegrity { - - // private static boolean isFine = false; - - // integrity check on permissions put by user for an image - public static boolean[] isIntegreForImage(boolean isRead, boolean isWrite, - boolean isLink, boolean isAdmin) { - - // boolean array for the correct result values - boolean[] rights = new boolean[4]; - rights[0] = isRead; - rights[1] = isWrite; - rights[2] = isLink; - rights[3] = isAdmin; - - System.out.println("*****************************"); - System.out.println(isRead + " " + isWrite + " " + isLink + " " - + isAdmin); - - if (isRead) // if read is allowed, only read is allowed - { - rights[0] = true; // read allowed - } else // if read is not allowed, nothing is allowed - { - rights[0] = false; - rights[1] = false; - rights[2] = false; - rights[3] = false; - } - - if (isWrite) // if write was selected - { - rights[0] = true; - rights[1] = true; - } else // if write was unselected - { - // rights[0] = false; - rights[1] = false; - } - - if (isLink) // if link was selected, read and link are allowed - { - rights[0] = true; - rights[2] = true; - } else // if link is unselected, link is not allowed - { - rights[2] = false; - } - - if (isAdmin) // if admin is selected, anything is allowed - { - rights[0] = true; - rights[1] = true; - rights[2] = true; - rights[3] = true; - } else // if admin is unselected, admin is not allowed - { - rights[3] = false; - } - - System.out.println(">-------------<"); - System.out.println(rights[0] + " " + rights[1] + " " + rights[2] + " " - + rights[3]); - - return rights; - - }// end isIntegreForImage() - - - // integrity check on permissions put by user for a lecture - public static boolean[] isIntegreForLecture(boolean isRead, boolean isWrite, boolean isAdmin) { - - // boolean array for the correct result values - boolean[] rights = new boolean[4]; - rights[0] = isRead; - rights[1] = isWrite; - rights[2] = isAdmin; - - System.out.println("*****************************"); - System.out.println(isRead + " " + isWrite + " " + isAdmin); - - if (isRead) // if read is allowed, only read is allowed - { - rights[0] = true; // read allowed - } else // if read is not allowed, nothing is allowed - { - rights[0] = false; - rights[1] = false; - rights[2] = false; - } - - if (isWrite) // if write was selected - { - rights[0] = true; - rights[1] = true; - } else // if write was unselected - { - // rights[0] = false; - rights[1] = false; - } - - if (isAdmin) // if admin is selected, anything is allowed - { - rights[0] = true; - rights[1] = true; - rights[2] = true; - } else // if admin is unselected, admin is not allowed - { - rights[2] = false; - } - - System.out.println(">-------------<"); - System.out.println(rights[0] + " " + rights[1] + " " + rights[2]); - - return rights; - - }// end isIntegreForLecture() - -} diff --git a/dozentenmodul/src/main/java/util/FormatHelper.java b/dozentenmodul/src/main/java/util/FormatHelper.java deleted file mode 100644 index ad1f02f9..00000000 --- a/dozentenmodul/src/main/java/util/FormatHelper.java +++ /dev/null @@ -1,35 +0,0 @@ -package util; - -import java.text.ParseException; -import java.text.SimpleDateFormat; - -public class FormatHelper { - - private static final SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - private static final SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - - /** - * Convert mysql date/time format to human readable (German) format. - * If the given date is not parsable, "<invalid>" will be returned. - * - * @param dateTime yyyy-MM-dd HH:mm:ss - * @return dd.MM.yy HH:mm - */ - public static String mysqlDateToGerman(String dateTime) { - try { - return out.format(in.parse(dateTime)); - } catch (ParseException e) { - return "<invalid>"; - } - } - - public static String byteToGigabyte(long bytes, boolean si) { - int unit = si ? 1000 : 1024; - if (bytes < unit) - return bytes + " B"; - int exp = (int) (Math.log(bytes) / Math.log(unit)); - String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i"); - return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); - } - -} diff --git a/dozentenmodul/src/main/java/util/MessageType.java b/dozentenmodul/src/main/java/util/MessageType.java deleted file mode 100644 index 294e28d6..00000000 --- a/dozentenmodul/src/main/java/util/MessageType.java +++ /dev/null @@ -1,23 +0,0 @@ -package util; - -import javax.swing.JOptionPane; - -import org.apache.log4j.Priority; - -@SuppressWarnings("deprecation") -public enum MessageType { - DEBUG(JOptionPane.INFORMATION_MESSAGE, "Debug", Priority.DEBUG), - INFO(JOptionPane.INFORMATION_MESSAGE, "Hinweis", Priority.INFO), - WARNING(JOptionPane.WARNING_MESSAGE, "Warnung", Priority.WARN), - ERROR(JOptionPane.ERROR_MESSAGE, "Fehler", Priority.ERROR); - - public final String title; - public final int optionPaneId; - public final Priority logPriority; - - private MessageType(int paneId, String title, Priority prio) { - this.title = title; - this.optionPaneId = paneId; - this.logPriority = prio; - } -} diff --git a/dozentenmodul/src/main/java/util/News.java b/dozentenmodul/src/main/java/util/News.java deleted file mode 100644 index 5f3ea776..00000000 --- a/dozentenmodul/src/main/java/util/News.java +++ /dev/null @@ -1,236 +0,0 @@ -package util; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.sql.Date; - -import javax.swing.JOptionPane; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.openslx.bwlp.thrift.iface.SessionData; - -import org.apache.log4j.Logger; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -/** - * Class representing the news given by the satellite - * Makes use of the News-API of the webservice slx-admin: - * http://satellite.ip/slx-admin/api.php?do=news - * - * Access the data through the public getters: - * String newsHeadline = News.getHeadline(); - * String newsContent = News.getContent(); - * Date newsLatestDate = News.getDate(); - */ - -public class News { - - // Logger instance for this class - private final static Logger LOGGER = Logger.getLogger(News.class); - - // Private members representing the news - private static String headline = null; - private static String content = null; - private static Date date = null; - - /** - * Gets the headline as String. - * - * @return String Contains the headline text. - */ - public static String getHeadline() { - if (headline != null) - return headline; - else { - init(); - // check if it is still null - if (headline != null) - return headline; - else - return null; - } - } - - /** - * Gets the content as String. - * - * @return String Contains the content text. - */ - public static String getContent() { - if (content != null) - return content; - else { - init(); - if (content != null) - return content; - else - return null; - } - } - - /** - * Gets the date of the latest news as Date. - * - * @return Date Represent last modification date. - */ - public static Date getDate() { - if (date != null) - return date; - else { - init(); - if (date != null) - return date; - else - return null; - } - } - - /** - * Private 'init' function doing the main work. - * It is called by getters if their object is null. - * Follows these steps: - * - Opens URL as stream - * - Parse stream as (XML-)Document - * - Check validity of the news format: - * <news> - * <headline>...</headline> - * <content>...</content> - * <date>...</date> - * </news> - * - * - Sets private members - */ - - private static void init(){ - // Document representing the XML - Document doc = null; - String satIp = SessionData._Fields.SERVER_ADDRESS.toString(); - // sanity check to see if we have the satellite IP - if (satIp == null || satIp.isEmpty()) { - LOGGER.error("No satellite IP adress is set in SessionData, aborting news fetching..."); - return; - } - - // URL to news API - URL url = null; - try { - url = new URL("http://" + SessionData._Fields.SERVER_ADDRESS.toString() + "/slx-admin/api.php?do=news"); - } catch (MalformedURLException e) { - LOGGER.error("Malformated URL to News-API, see trace: ", e); - } - - // check is the url got created. - if (url == null) { - // no URL, log it and return - LOGGER.error("URL to the News-API not defined!"); - return; - } - - // set timeout for URLConnection - URLConnection urlCon = null; - try { - urlCon = url.openConnection(); - // 5 seconds timeout for connection - urlCon.setConnectTimeout(5000); - // 10 seconds timeout for reading the stream - urlCon.setReadTimeout(10000); - } catch (IOException e) { - LOGGER.error("IO error while requesting News URL, see trace: ", e); - return; - } - - InputStream is = null; - try { - is = urlCon.getInputStream(); - } catch (IOException e1) { - LOGGER.error("Could not open stream to URL '" + url.toString() + "', see trace: ", e1); - return; - } - - // use java's DocumentBuilder engine to parse the XML - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = null; - - try { - builder = factory.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - LOGGER.error("XML parsing configuration error, see trace: ", e); - return; - } - - // try the parsing - try { - doc = builder.parse(is); - } catch (SAXException e) { - LOGGER.error("XML parsing error, see trace: ", e); - return; - } catch (IOException e) { - LOGGER.error("IO-Error, see trace: ", e); - return; - } - - // now that we have parsed the XML, check if it is valid - Element docRoot = doc.getDocumentElement(); - - // first element has to be name "news" - if (docRoot.getNodeName().equals("news")) { - Node headlineNode = null; - Node contentNode = null; - Node dateNode = null; - - // get list of every child - NodeList nList = docRoot.getElementsByTagName("*"); - - // fail if the list is empty - if (nList == null) return; - - // now we go through the list looking for our elements - // TODO: get definition of tags externally/through static api? - for (int i = 0; i < nList.getLength(); i++) { - Node current = nList.item(i); - if (current.getNodeType() == Node.ELEMENT_NODE) { - if (current.getNodeName().equals("headline") && - current.getFirstChild().getNodeType() == Node.TEXT_NODE) headlineNode = current.getFirstChild(); - // FIXME: temporary workaround for possibly different slx-admin versions! - if ((current.getNodeName().equals("info") || current.getNodeName().equals("content")) && - current.getFirstChild().getNodeType() == Node.TEXT_NODE) contentNode = current.getFirstChild(); - if (current.getNodeName().equals("date") && - current.getFirstChild().getNodeType() == Node.TEXT_NODE) dateNode = current.getFirstChild(); - } - } - - // set what the elements we found - if (headlineNode != null) headline = headlineNode.getNodeValue().trim(); - if (contentNode != null) content = contentNode.getNodeValue().trim(); - if (dateNode != null) { - // for the date we need a bit more stuff - Date tmpDate = null; - try { - tmpDate = new Date(Long.parseLong(dateNode.getNodeValue().trim()) * 1000); - } catch (NumberFormatException nfe) { - LOGGER.error("Date format is invalid, see trace: ", nfe); - JOptionPane.showMessageDialog(null, - "Zeitstempel aus der XML is invalid!", - "Fehler", JOptionPane.ERROR_MESSAGE); - // TODO: set current date. - } - // Date creation worked, save it - if (tmpDate != null) date = tmpDate; - } - } else { - JOptionPane.showMessageDialog(null, - "Invalides XML! Kein 'news' Wurzelelement. News wird leer gelassen.", - "Fehler", JOptionPane.ERROR_MESSAGE); - return; - } - } -} diff --git a/dozentenmodul/src/main/java/util/OpenLinks.java b/dozentenmodul/src/main/java/util/OpenLinks.java deleted file mode 100644 index 2bde54bf..00000000 --- a/dozentenmodul/src/main/java/util/OpenLinks.java +++ /dev/null @@ -1,82 +0,0 @@ -package util; - -import java.awt.Desktop; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.JOptionPane; - -import org.apache.log4j.Logger; - -public class OpenLinks { - - /** - * Logger instance for this class - */ - private final static Logger LOGGER = Logger.getLogger(OpenLinks.class); - - /** - * Map containing the links - */ - @SuppressWarnings("serial") - private static Map<String, String> links = Collections.unmodifiableMap(new HashMap<String, String>(){{ - put("faq", "http://bwlehrpool.hs-offenburg.de"); - put("otrs", "http://bwlehrpool.hs-offenburg.de"); - put("vmware", "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0"); - put("intro", "http://www.hs-offenburg.de/fileadmin/Einrichtungen/hrz/Projekte/bwLehrpool/3_bwLehrpool_-_Image_einbinden_und_starten.pdf"); - - }}); - - /** - * Static URIs - */ - - private static Map<String, URI> uris; - static { - // temp map - Map<String, URI> tmpUris = new HashMap<String, URI>(); - for (String key : links.keySet()) { - URI tmp; - try { - tmp = new URI(links.get(key)); - } catch (URISyntaxException e) { - // should never happen! - LOGGER.error("Bad URI syntax of '" + key + "', see trace: ", e); - tmp = null; - } - tmpUris.put(key, tmp); - } - // check sizes of maps to be equal - if (links.size() != tmpUris.size()) { - LOGGER.error("Links and URIs have different sizes, this should not happen. Contact a developper."); - } - - // all good, save it to the actual 'uris' map - uris = Collections.unmodifiableMap(tmpUris); - } - - - public static void openWebpage(String key) { - // first check if we have the link for the request key - if (!uris.containsKey(key)) { - LOGGER.error("OpenLinks has to link to '" + key + "'. Check if the given key actually exists."); - return; - } - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() - : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - desktop.browse(uris.get(key)); - } catch (Exception e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause() + "\n" + e.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - }// end openWebpage - -} diff --git a/dozentenmodul/src/main/java/util/ResourceLoader.java b/dozentenmodul/src/main/java/util/ResourceLoader.java deleted file mode 100644 index 8ad23601..00000000 --- a/dozentenmodul/src/main/java/util/ResourceLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -package util; - -import gui.GuiManager; - -import java.awt.Graphics2D; -import java.awt.SystemColor; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.net.URL; - -import javax.swing.ImageIcon; - -import org.apache.commons.io.IOUtils; -import org.apache.log4j.Logger; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Text; - -/** - * Helper class for loading resources. This should be error safe loaders with a - * fall back in case the requested resource can't be found, or isn't of the - * expected type. - */ -public class ResourceLoader { - - /** - * Logger for this class - */ - private final static Logger LOGGER = Logger.getLogger(ResourceLoader.class); - - public static ImageData getImageData(String path) { - - ImageData _imgData = null; - URL _url = ResourceLoader.class.getResource(path); - if (_url == null) { - LOGGER.error("Resource not found: " + path); - return errorIcon("nope").getImageData(); - } else { - try { - _imgData = new ImageData(_url.openStream()); - } catch (Exception e) { - LOGGER.error("Resource not loadable: " + path + ". See trace: ", e); - return errorIcon("nope").getImageData(); - } - return _imgData; - } - } - - /** - * Helper that will create an icon with given text. - * @param errorText Text to render to icon - * @return the icon - */ - private static Image errorIcon(String errorText) { - GC gc = new GC(GuiManager.getDisplay()); - Font font = new Font(GuiManager.getDisplay(), "Tahoma", 20, SWT.NORMAL); - gc.setFont(font); - // get dimensions of text - Image image = new Image(GuiManager.getDisplay(), gc.stringExtent(errorText).x, gc.stringExtent(errorText).y); - GC gc2 = new GC(image); - gc2.setBackground(GuiManager.getDisplay().getSystemColor(SWT.COLOR_CYAN)); - gc2.drawText(errorText, 0, 0); - gc2.dispose(); - return image; - } - - /** - * Tries to load the given resource treating it as a text file - * - * @param path - * Resource path to load - * @return content of the loaded resource as String - */ - public static String getTextFile(String path) { - String fileContent = null; - try { - fileContent = IOUtils.toString(ResourceLoader.class - .getResourceAsStream(path)); - } catch (Exception e) { - LOGGER.error("IO error while trying to load resource '" + path - + "'. See trace: ", e); - } - - if (fileContent != null) { - return fileContent; - } else { - return "Resource '" + path + "' not found."; - } - } -} diff --git a/dozentenmodul/src/main/java/util/ServiceProviderResponse.java b/dozentenmodul/src/main/java/util/ServiceProviderResponse.java deleted file mode 100644 index 37b93b33..00000000 --- a/dozentenmodul/src/main/java/util/ServiceProviderResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package util; - -import java.util.HashMap; - -public class ServiceProviderResponse { - public String status; - public String firstName; - public String lastName; - public String mail; - public HashMap<String, String> satellites; - public String token; - public String sessionId; - public String url; - public String error; -} diff --git a/dozentenmodul/src/main/java/util/ShibbolethECP.java b/dozentenmodul/src/main/java/util/ShibbolethECP.java deleted file mode 100644 index 7844a51e..00000000 --- a/dozentenmodul/src/main/java/util/ShibbolethECP.java +++ /dev/null @@ -1,172 +0,0 @@ -package util; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; - -import org.apache.http.HttpResponse; -import org.apache.http.ParseException; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.util.EntityUtils; -import org.apache.log4j.Logger; -import org.openslx.bwlp.thrift.iface.AuthenticationError; -import org.openslx.bwlp.thrift.iface.TAuthenticationException; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonSyntaxException; - -import edu.kit.scc.dei.ecplean.ECPAuthenticationException; -import edu.kit.scc.dei.ecplean.ECPAuthenticator; - -public class ShibbolethECP { - - /** - * Logger instance for this class - */ - private final static Logger LOGGER = Logger.getLogger(ShibbolethECP.class); - - /** - * Static gson object for (de)serialization - */ - private static final Gson GSON = new GsonBuilder().create(); - - /** - * ServiceProviderResponse Object representing the last response we received - */ - private static ServiceProviderResponse lastResponse = null; - /** - * URL for bwLehrpool registration - */ - private static URL registrationUrl = null; - /** - * Return codes - */ - public static enum ReturnCode { - NO_ERROR(0, "Authentication against the identity provider and request of the service provider resource worked."), - IDP_ERROR(1, "Authentication against the identity provider failed."), - UNREG_ERROR(2, "User not registered to use bwLehrpool."), - ERROR_SP(3, "Invalid resource of the service provider."), - ERROR_URL(4, "Invalid URL received from master server."), - ERROR_OTHER(5, "Internal error."); - - private final int id; - private final String msg; - - ReturnCode(int id, String msg) { - this.id = id; - this.msg = msg; - } - - public int getId() { - return this.id; - } - - public String getMsg() { - return this.msg; - } - } - - /** - * Static URI to the SP. - */ - private final static URI BWLP_SP; - static { - URI tmp; - try { - tmp = new URI("https://bwlp-masterserver.ruf.uni-freiburg.de/webif/shib/api.php"); - } catch (URISyntaxException e) { - // should never happen! - LOGGER.error("Bad URI syntax of the service provider, see trace: ", e); - tmp = null; - } - BWLP_SP = tmp; - } - - public static ServiceProviderResponse getResponse() { - return lastResponse; - } - /** - * Fetches the resource - * - * @param idpUrl - * URL of the identity provider to authenticate against, as String. - * @param user - * Username as String. - * @param pass - * Password as String. - * @return - * true if login worked, false otherwise. - * @throws TAuthenticationException - */ - public static ReturnCode doLogin(final String idpUrl, final String user, final String pass) - throws TAuthenticationException, URISyntaxException, ClientProtocolException, IOException, - ParseException, JsonSyntaxException, MalformedURLException { - - // first lets do some sanity checks - if (BWLP_SP == null) { - LOGGER.error("URI to service provider is not set. Check the initialization of 'BWLP_SP'."); - return ReturnCode.ERROR_OTHER; - } - if (idpUrl == null) { - LOGGER.error("Identity provider is not set, did you initialize this class correctly?"); - return ReturnCode.ERROR_OTHER; - } - if (user == null) { - LOGGER.error("No username given, aborting..."); - return ReturnCode.ERROR_OTHER; - } - if (pass == null) { - LOGGER.error("No password given, aborting..."); - return ReturnCode.ERROR_OTHER; - } - - // now init the authenticator for that idp and our static sp - final ECPAuthenticator auth = new ECPAuthenticator(user, pass, new URI(idpUrl), BWLP_SP); - - try { - auth.authenticate(); - } catch (ECPAuthenticationException e) { - LOGGER.error("ECP Authentication Exception, see trace: ", e); - throw new TAuthenticationException(AuthenticationError.GENERIC_ERROR, e.getMessage()); - } - // here test again for the SP's URL - final HttpGet testSp = new HttpGet(BWLP_SP); - final HttpResponse response = auth.getHttpClient().execute(testSp); - - LOGGER.debug("SP request returned: " + response.getStatusLine()); - final String responseBody = EntityUtils.toString(response.getEntity()); - - lastResponse = GSON.fromJson(responseBody, ServiceProviderResponse.class); - - // TODO: here we will need to parse the answer accordingly. - // no errors, meaning everything worked fine. - if (lastResponse.status.equals("unregistered")) { - registrationUrl = new URL(lastResponse.url); - return ReturnCode.UNREG_ERROR; - } - // TODO the rest of the cases... - if (lastResponse.status.equals("error")) { - LOGGER.error("Server side error: " + lastResponse.error); - return ReturnCode.ERROR_OTHER; - } - if (lastResponse.status.equals("anonymous")) { - LOGGER.error("IdP did not forward user account information to SP. Contact developper."); - return ReturnCode.ERROR_OTHER; - } - if (lastResponse.status.equals("ok")) { - return ReturnCode.NO_ERROR; - } - // still here? then something else went wrong - return ReturnCode.ERROR_OTHER; - } - /** - * @return Registration URL given by the SP. - */ - public static URL getRegistrationUrl() { - return registrationUrl; - } -} |
