Skip to content
Snippets Groups Projects
Commit 79589da5 authored by Mike McKay's avatar Mike McKay
Browse files

Merge branch 'master' of https://bitbucket.org/xnatdev/xnat-web

parents fed7963a 417a5fd2
Branches
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ import org.restlet.resource.StringRepresentation; ...@@ -30,6 +30,7 @@ import org.restlet.resource.StringRepresentation;
import org.restlet.resource.Variant; import org.restlet.resource.Variant;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -93,13 +94,14 @@ public class AliasTokenRestlet extends SecureResource { ...@@ -93,13 +94,14 @@ public class AliasTokenRestlet extends SecureResource {
Map<String, String> map = Maps.newHashMap(); Map<String, String> map = Maps.newHashMap();
map.put("alias", token.getAlias()); map.put("alias", token.getAlias());
map.put("secret", token.getSecret()); map.put("secret", token.getSecret());
String value = ""; if (token.getEstimatedExpirationTime() != null) {
map.put("estimatedExpirationTime", FORMATTER.format(token.getEstimatedExpirationTime()));
}
try { try {
value = _serializer.toJson(map); return _serializer.toJson(map);
} catch (IOException e) { } catch (IOException ignored) {
// return "";
} }
return value;
} }
@Override @Override
...@@ -114,7 +116,8 @@ public class AliasTokenRestlet extends SecureResource { ...@@ -114,7 +116,8 @@ public class AliasTokenRestlet extends SecureResource {
return _service; return _service;
} }
private static final int INVALID = -1; private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("yyyyMMdd_HHmmss");
private final SerializerService _serializer; private final SerializerService _serializer;
private AliasTokenService _service; private AliasTokenService _service;
private String _operation; private String _operation;
......
...@@ -120,7 +120,7 @@ public class XnatAuthenticationFilter extends UsernamePasswordAuthenticationFilt ...@@ -120,7 +120,7 @@ public class XnatAuthenticationFilter extends UsernamePasswordAuthenticationFilt
try { try {
AccessLogger.LogServiceAccess(username, AccessLogger.GetRequestIp(request), "Authentication", "SUCCESS"); AccessLogger.LogServiceAccess(username, AccessLogger.GetRequestIp(request), "Authentication", "SUCCESS");
Authentication auth = getAuthenticationManager().authenticate(authRequest); Authentication auth = getAuthenticationManager().authenticate(authRequest);
//Fixed XNAT-4409 by adding a check for a par parameter on login. If a PAR is present and valid, then grant the user that just logged in the appropriate project permissions. //Fixed XNAT-4409 by adding a check for a par parameter on login. If a PAR is present and valid, then grant the user that just logged in the appropriate project permissions.
if(StringUtils.isNotBlank(request.getParameter("par"))){ if(StringUtils.isNotBlank(request.getParameter("par"))){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment