| | |
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import javax.servlet.http.HttpSession;
|
| | |
|
| | | import org.eclipse.jgit.util.Base64;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.Base64;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
|
| | | /**
|
| | |
| | | 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];
|
| | |
| | | public AuthenticatedRequest(HttpServletRequest req) {
|
| | | super(req);
|
| | | user = new UserModel("anonymous");
|
| | | user.isAuthenticated = false;
|
| | | }
|
| | | |
| | |
|
| | | UserModel getUser() {
|
| | | return user;
|
| | | }
|
| | |
| | | if (role.equals(Constants.ADMIN_ROLE)) {
|
| | | 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);
|
| | | }
|
| | |
|