Split rest authentication into two. For web apps integration url is /c/restful/

This commit is contained in:
Paulo Gustavo Veiga
2012-11-10 17:19:28 -03:00
parent 6a9d1c684e
commit a228ea6ed5
39 changed files with 178 additions and 113 deletions

View File

@@ -18,7 +18,11 @@ abstract public class ClientException extends WiseMappingException {
String getMsgBundleKey();
public String getMessage(@NotNull final MessageSource messageSource, final @NotNull Locale locale) {
return messageSource.getMessage(this.getMsgBundleKey(), null, locale);
return messageSource.getMessage(this.getMsgBundleKey(), this.getMsgBundleArgs(), locale);
}
protected Object[] getMsgBundleArgs(){
return null;
}
public Severity getSeverity() {

View File

@@ -35,4 +35,9 @@ public class MultipleSessionsOpenException
protected String getMsgBundleKey() {
return MSG_KEY;
}
@Override
protected Object[] getMsgBundleArgs() {
return new String[]{"you"};
}
}

View File

@@ -18,17 +18,15 @@
package com.wisemapping.exceptions;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SessionExpiredException
extends ClientException {
public static final String MSG_KEY = "MINDMAP_TIMESTAMP_OUTDATED";
@Nullable
private Collaborator lastUpdater;
private User lastUpdater;
public SessionExpiredException(@Nullable Collaborator lastUpdater) {
public SessionExpiredException(@NotNull User lastUpdater) {
super("Map has been updated by " + (lastUpdater != null ? lastUpdater.getEmail() : ""), Severity.FATAL);
this.lastUpdater = lastUpdater;
}
@@ -38,4 +36,9 @@ public class SessionExpiredException
protected String getMsgBundleKey() {
return MSG_KEY;
}
@Override
protected Object[] getMsgBundleArgs() {
return new String[]{lastUpdater.getFullName() + "<" + lastUpdater.getEmail() + ">"};
}
}