From 856c8a2ad521064d69b2b50003c1df382d375013 Mon Sep 17 00:00:00 2001
From: Marcin Floryan <marcin.floryan@gmail.com>
Date: Sat, 03 Nov 2012 15:15:22 -0400
Subject: [PATCH] Download progress - CR character behaves as expected on Windows but not on other platforms.
---
src/com/gitblit/AuthenticationFilter.java | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/com/gitblit/AuthenticationFilter.java b/src/com/gitblit/AuthenticationFilter.java
index 277b220..4762c42 100644
--- a/src/com/gitblit/AuthenticationFilter.java
+++ b/src/com/gitblit/AuthenticationFilter.java
@@ -103,7 +103,7 @@
String credentials = new String(Base64.decode(base64Credentials),
Charset.forName("UTF-8"));
// credentials = username:password
- final String[] values = credentials.split(":");
+ final String[] values = credentials.split(":",2);
if (values.length == 2) {
String username = values[0];
@@ -170,8 +170,9 @@
public AuthenticatedRequest(HttpServletRequest req) {
super(req);
user = new UserModel("anonymous");
+ user.isAuthenticated = false;
}
-
+
UserModel getUser() {
return user;
}
@@ -188,8 +189,11 @@
@Override
public boolean isUserInRole(String role) {
if (role.equals(Constants.ADMIN_ROLE)) {
- return user.canAdmin;
+ return user.canAdmin();
}
+ // Gitblit does not currently use actual roles in the traditional
+ // servlet container sense. That is the reason this is marked
+ // deprecated, but I may want to revisit this.
return user.canAccessRepository(role);
}
--
Gitblit v1.9.1