Author: michiel
Date: 2010-04-09 14:08:26 +0200 (Fri, 09 Apr 2010)
New Revision: 41817
Modified:
didactor/trunk/components/core/src/main/java/nl/didactor/security/Authentication.java
Log:
fixed a small detail related to repeatedlyu failing to log in
Modified:
didactor/trunk/components/core/src/main/java/nl/didactor/security/Authentication.java
===================================================================
---
didactor/trunk/components/core/src/main/java/nl/didactor/security/Authentication.java
2010-04-09 10:12:46 UTC (rev 41816)
+++
didactor/trunk/components/core/src/main/java/nl/didactor/security/Authentication.java
2010-04-09 12:08:26 UTC (rev 41817)
@@ -39,6 +39,7 @@
private static final Logger log =
Logging.getLoggerInstance(Authentication.class);
public static String REASON_KEY = "nl.didactor.security.reason";
+ public static String TRYCOUNT_KEY = "nl.didactor.security.trycount";
final List<AuthenticationComponent> securityComponents = new
CopyOnWriteArrayList<AuthenticationComponent>();
@@ -288,7 +289,7 @@
locale =
ContextProvider.getDefaultCloudContext().getDefaultLocale();
}
session.setAttribute(REASON_KEY, se.getMessage(locale));
- log.service("For ac " + se.getMessage());
+ log.service("For ac " + se.getMessage(locale) + " set in " +
session);
}
}
@@ -346,9 +347,16 @@
if (referUrl.toString().startsWith("/")) {
referUrl.insert(0, request.getContextPath());
}
+ HttpSession session = request.getSession(true);
+ Integer trycount = (Integer)
session.getAttribute(TRYCOUNT_KEY);
+ if (trycount == null) {
+ trycount = 0;
+ }
+ session.setAttribute(TRYCOUNT_KEY, ++trycount);
+ referUrl.append("&try=").append(trycount); // make sure we
are not redirecting to where we already are. That won't work.
// how about the paramters already present. This seems to
be too simple. Escaping?
String redirect =
response.encodeRedirectURL(referUrl.toString());
- log.debug("Redirecting to " + redirect);
+ log.debug("Redirecting to " + redirect + " with " +
response);
response.sendRedirect(redirect);
} catch (Exception e) {
throw new SecurityException("Can't redirect to login
page(" + loginPage + ") because " + e.getClass() + ":" + e.getMessage(), e);
@@ -364,7 +372,9 @@
public boolean isValid(org.mmbase.security.UserContext userContext)
throws org.mmbase.security.SecurityException {
if (userContext instanceof UserContext) {
UserContext uc = (UserContext) userContext;
- log.debug("found " + uc);
+ if (log.isTraceEnabled()) {
+ log.trace("found " + uc);
+ }
if (uc.getRank().equals(Rank.ADMIN)) return true;
if (uc.getRank().equals(Rank.ANONYMOUS)) return true;
checkBuilder();
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs