]> source.dussan.org Git - gitblit.git/log
gitblit.git
7 years agoFix nullpointer exception with unsupported URL protocol #1237
Martin Spielmann [Sun, 21 May 2017 20:50:48 +0000 (22:50 +0200)]
Fix nullpointer exception with unsupported URL protocol #1237

7 years agoMerge pull request #4 from gitblit/master
Martin [Mon, 24 Apr 2017 19:30:06 +0000 (21:30 +0200)]
Merge pull request #4 from gitblit/master

merge upstream master

7 years agoMerge pull request #1168 from lucamilanesio/bump-to-lucene-5.5.2
Florian Zschocke [Sat, 18 Mar 2017 12:37:25 +0000 (13:37 +0100)]
Merge pull request #1168 from lucamilanesio/bump-to-lucene-5.5.2

Bump to Lucene 5.5.2

The new code will create Lucene indices in a new directory named after codec and index version.
This provides for easy and safe up- and downgrades. But it also means that the old indices will
stick around on disk. What this version is missing is a kind of "garbage collection" deleting old, unused
indices when they are no longer needed. That task needs to be done manually currently. We should
at leas at some point provide a script for it.

7 years agoReindex tickets on server start if no index exists 1168/head
Florian Zschocke [Sun, 5 Mar 2017 19:12:48 +0000 (20:12 +0100)]
Reindex tickets on server start if no index exists

Check if tickets need to be reindexed when the server starts. This is the
case if no ticket index exists. In that case the ticket index is built.

This is done during the start of the `ITicketService`.

For this the interface of `ITicketService` needed to change. The `start`
method was defined abstract and the specific ticket services had to
implement it. None does any real starting stuff in it.
The `start` method is now final. It calls a new abstract method `onStart`
which the specific ticket services need to implement. In the existing
implementations I just changed `start` to `onStart`.

7 years agoRevert "Add library `lucene-backward-codecs` to migrate indices."
Florian Zschocke [Mon, 9 Jan 2017 13:43:46 +0000 (14:43 +0100)]
Revert "Add library `lucene-backward-codecs` to migrate indices."

This reverts commit 662fb9012fb6897c9b05c939232919797e665f38.

7 years agoUse versioned index directories for repository indices.
Florian Zschocke [Sun, 5 Mar 2017 16:11:50 +0000 (17:11 +0100)]
Use versioned index directories for repository indices.

Change from the index version of a repository index being stored in a config
file to also using index directories with the version in the name. For that,
`LuceneRepoIndexStore` is added, which adds the fixed `lucene` part to the path.
It also gives out the location of the `lucene.conf` file, which is now stored in
the index directory. This way it is automatically deleted when the directory is
deleted.

I believe that it should also provide means to store branch aliases and tips,
i.e. hide the config file completely. But this isn't implemented with this
commit, the `LuceneService` is still aware that a config file is used.

7 years agoIntroduce an index version for the ticket index
Florian Zschocke [Sun, 5 Mar 2017 15:45:44 +0000 (16:45 +0100)]
Introduce an index version for the ticket index

In order to be able to update the index definition, the ticket index
is assigned a version number, 2. This way the definiton can be updated
and compatability with existing index files can be checked.
The actual index is stored in a directory of name `indexVersion_codecVersion`.
This wayit is veriy easy to check if an index of a certain version exists on the
filesystem. It allows to have multiple indexes of different versions present,
so that a downgrade of the software is possible without having to reindex
again. Of coure, this is only possible if no new tickets were created since these
would be missing in the old index.

A new class `LuceneIndexStore` is introduced, which abstracts away the versioned
index directory. The idea is, that this provides one place to keep the Lucene
codec version and to allow to code compatibility rules into this class, so that
older indices can still be used if they are compatible.

7 years agoAdd DocValues to support sorting of ticket index fields.
Florian Zschocke [Sun, 26 Feb 2017 17:44:02 +0000 (18:44 +0100)]
Add DocValues to support sorting of ticket index fields.

In order to support sorting, Lucene 5 needs DocValue fields in an index.
So in order to make the ticket index work, i.e. show any tickets on the
tickets page, the ticket index needs to be changed, adding a DocValues
field.

The DocValuesFields are implemented for the current index, which does not
use multiple values for a field. Should at any time in the future an
existing numeric field get multiple values stored in a document, then
the index needs to know that and use SortedNumeric DocValues and SortFields
instead.

7 years agoReplace deprecated BooleanQuery constructor with builder.
Florian Zschocke [Sat, 21 Jan 2017 18:09:18 +0000 (19:09 +0100)]
Replace deprecated BooleanQuery constructor with builder.

Also replace deprecated `search` method with the one without a filter
argument, since the filter isn't used anyhow.

7 years agoUpdate link target to Lucene 5.5 query syntax, moving the link to the page.
Florian Zschocke [Sat, 21 Jan 2017 17:05:53 +0000 (18:05 +0100)]
Update link target to Lucene 5.5 query syntax, moving the link to the page.

Update the link target to the query parser syntax page of the 5.5 version.

Refactor the `LuceneSearchPage` to use an `ExternalLink` for the link
to the lucene page, so that the link target is kept and updated in the
Java code. Move the link out of the language files. This was way too
cumbersome to update the link target (which is probably why no one ever
did).

The query help text is changed to contain a variable:
`gb.queryHelp = here be some ${querySyntax} help`, which is replaced by
Wicket with a link.
The link text is a new lange file property: `gb.querySyntax`.

7 years agoRemove obsolete Lucene version constants.
Florian Zschocke [Sat, 14 Jan 2017 23:11:16 +0000 (00:11 +0100)]
Remove obsolete Lucene version constants.

7 years agoAdd library `lucene-backward-codecs` to migrate indices.
Florian Zschocke [Mon, 9 Jan 2017 13:43:46 +0000 (14:43 +0100)]
Add library `lucene-backward-codecs` to migrate indices.

To be able to read and migrate Lucene indices from old (4.x)
formats to new (5.x) ones, add the `lucene-backward-codecs`
library to the project.
It is added to the `ext` directory and therefore to the classpath.
According to the Lucene documentation, having it in the classpath
can affect performance. But right now the `ext` directory is the
only one available and even for a separate tool for offline
migration the library would be needed.

7 years agoExclude Lucene transitive dependencies.
Florian Zschocke [Mon, 2 Jan 2017 15:59:44 +0000 (16:59 +0100)]
Exclude Lucene transitive dependencies.

Exclude Lucene dependencies `lucene-spatial` and `lucene-join`.
They were added during the update but are not needed. This patch
excludes them explicitly so that they do not show up in the
generated IDE files and `ext` directory.

7 years agoBump to Lucene 5.5.2
Luca Milanesio [Thu, 22 Dec 2016 00:42:56 +0000 (00:42 +0000)]
Bump to Lucene 5.5.2

7 years agoMerge pull request #1207 from j123b567/fix/cs_locale
James Moger [Fri, 3 Mar 2017 15:53:03 +0000 (10:53 -0500)]
Merge pull request #1207 from j123b567/fix/cs_locale

Better Czech localization

7 years agoBetter Czech localization 1207/head
Jan Breuer [Fri, 3 Mar 2017 14:37:37 +0000 (15:37 +0100)]
Better Czech localization

7 years agoMerge pull request #1202 from j123b567/feature/treeViewTable
James Moger [Tue, 21 Feb 2017 14:30:18 +0000 (09:30 -0500)]
Merge pull request #1202 from j123b567/feature/treeViewTable

Prevent last column on Tree page from wraping

7 years agoPrevent last column on Tree page from wraping 1202/head
Jan Breuer [Mon, 20 Feb 2017 16:35:49 +0000 (17:35 +0100)]
Prevent last column on Tree page from wraping

With localizations, there can be longer text then 13em so there is a line break.
This fix prevent this line breaking and thus every line has normal height again.

7 years agoMerge pull request #1201 from j123b567/bug/1114
James Moger [Thu, 16 Feb 2017 13:17:20 +0000 (08:17 -0500)]
Merge pull request #1201 from j123b567/bug/1114

Fix #1114 HttpUtils getGitblitURL does not support nonstandard ports

7 years agoFix #1114 HttpUtils getGitblitURL does not support nonstandard ports 1201/head
Jan Breuer [Wed, 15 Feb 2017 17:58:55 +0000 (18:58 +0100)]
Fix #1114 HttpUtils getGitblitURL does not support nonstandard ports

X-Forwarded-Host can contain port number and it is added twice in that situation
This fix just prevent adding port number if it is already there

7 years agoMerge pull request #1200 from j123b567/locale/cs
James Moger [Wed, 15 Feb 2017 13:35:06 +0000 (08:35 -0500)]
Merge pull request #1200 from j123b567/locale/cs

Add Czech locale

7 years agoAdd Czech locale 1200/head
Jan Breuer [Mon, 13 Feb 2017 22:08:15 +0000 (23:08 +0100)]
Add Czech locale

7 years agoMerge pull request #1192 from mystygage/listBranchForRepository
James Moger [Wed, 8 Feb 2017 14:34:07 +0000 (09:34 -0500)]
Merge pull request #1192 from mystygage/listBranchForRepository

List branches from only one repository if a repository name is given

7 years agoMerge pull request #1198 from WilliamFromTW/master
James Moger [Wed, 8 Feb 2017 14:26:42 +0000 (09:26 -0500)]
Merge pull request #1198 from WilliamFromTW/master

New Setting "Default Language" when creating user

7 years agoNew Setting "Default Language" when creating user. 1198/head
william [Wed, 8 Feb 2017 00:35:01 +0000 (08:35 +0800)]
New Setting "Default Language" when creating user.

7 years agoList branches from only one repository if a repository name is given 1192/head
Markus Fömpe [Thu, 26 Jan 2017 12:50:54 +0000 (13:50 +0100)]
List branches from only one repository if a repository name is given

e.g.: https://localhost:8443/rpc/?req=LIST_REPOSITORY_BRANCHES&name=repo.git

Fix #1184

7 years agoMerge pull request #1187 from gitblit/revert-1186-listBranchForRepository
James Moger [Wed, 25 Jan 2017 14:17:53 +0000 (09:17 -0500)]
Merge pull request #1187 from gitblit/revert-1186-listBranchForRepository

Revert "New rpc endpoint for listing all branches from a given repository"

7 years agoRevert "New rpc endpoint for listing all branches from a given repository" 1187/head
James Moger [Wed, 25 Jan 2017 14:17:41 +0000 (09:17 -0500)]
Revert "New rpc endpoint for listing all branches from a given repository"

7 years agoMerge pull request #1186 from mystygage/listBranchForRepository
James Moger [Wed, 25 Jan 2017 14:17:12 +0000 (09:17 -0500)]
Merge pull request #1186 from mystygage/listBranchForRepository

New rpc endpoint for listing all branches from a given repository

7 years agoNew rpc endpoint for listing all branches from a given repository 1186/head
Markus Fömpe [Tue, 24 Jan 2017 10:54:01 +0000 (11:54 +0100)]
New rpc endpoint for listing all branches from a given repository

7 years agofix bug "get user default language null exception"
william [Wed, 25 Jan 2017 09:29:05 +0000 (17:29 +0800)]
fix bug "get user default language null exception"

7 years agoSending email (certificate zip file) based on locale that user selected 1185/head
william [Tue, 24 Jan 2017 09:30:01 +0000 (17:30 +0800)]
Sending email (certificate zip file) based on locale that user selected

7 years agoMerge pull request #1183 from RainerW/fixApacheProxySample
James Moger [Mon, 23 Jan 2017 18:56:24 +0000 (13:56 -0500)]
Merge pull request #1183 from RainerW/fixApacheProxySample

Documentation  update : "behind apache" also edit "Ajax-Location" header

7 years agowhen apache terminates https, the Ajax-Location header needs to be rewritten as well 1183/head
RainerW [Mon, 23 Jan 2017 18:35:25 +0000 (19:35 +0100)]
when apache terminates https, the Ajax-Location header needs to be rewritten as well

7 years agoMerge pull request #6 from fzs/sshAuthMethods
Florian Zschocke [Sat, 21 Jan 2017 15:31:52 +0000 (16:31 +0100)]
Merge pull request #6 from fzs/sshAuthMethods

Set list of offered SSH authentication methods.

7 years agoMerge pull request #1178 from srbala/patch-1
Florian Zschocke [Mon, 16 Jan 2017 19:51:30 +0000 (20:51 +0100)]
Merge pull request #1178 from srbala/patch-1

Update declaration to Servlet 3.0 in web.xml and weblogic.xml.
Fixes #1132

7 years agoUpdate weblogic.xml 1178/head
Bala Raman [Mon, 16 Jan 2017 19:29:45 +0000 (14:29 -0500)]
Update weblogic.xml

Update to web app 3.0 xsd

7 years agoUpdate to web.xml, fix to #1132
Bala Raman [Mon, 16 Jan 2017 00:05:48 +0000 (19:05 -0500)]
Update to web.xml, fix to #1132

Update to web.xml, fix to #1132

Fixes to namespace to fix xml parse error, where strict validation required

7 years agoMerge pull request #1171 from pingunaut/usermanager-file-instantiation
James Moger [Fri, 6 Jan 2017 14:41:44 +0000 (09:41 -0500)]
Merge pull request #1171 from pingunaut/usermanager-file-instantiation

Update UserManager to support construction of IUserServices with IRuntimeManager as a constructor parameter

7 years agoextracted method 1171/head
Martin Spielmann [Fri, 6 Jan 2017 00:09:37 +0000 (01:09 +0100)]
extracted method

7 years agoMerge pull request #1176 from ds5apn/master
James Moger [Thu, 5 Jan 2017 14:52:12 +0000 (09:52 -0500)]
Merge pull request #1176 from ds5apn/master

Update korean translation for gitblit new version.

7 years agoUpdate korean translation for gitblit new version. 1176/head
DONGSU, KIM [Thu, 5 Jan 2017 06:48:45 +0000 (15:48 +0900)]
Update korean translation for gitblit new version.

7 years agoIncrease minor version number to 9
Florian Zschocke [Mon, 2 Jan 2017 14:47:32 +0000 (15:47 +0100)]
Increase minor version number to 9

Bump version to 1.9.0-SNAPSHOT, increasing the minor as the next
release includes interface changes.

7 years agoMerge branch 'ci', enabling CI services.
Florian Zschocke [Mon, 2 Jan 2017 12:06:48 +0000 (13:06 +0100)]
Merge branch 'ci', enabling CI services.

7 years agoAdd build definition file for Circle CI
Florian Zschocke [Thu, 15 Dec 2016 21:10:37 +0000 (22:10 +0100)]
Add build definition file for Circle CI

Configure the build for Circle CI in the new file circle.yml.
Specify a compile step to have the build fail on compilation error.
The test step is then configured as `ant test`, which will compile
again due to the limits of Ant/Moxie.

Contrary to the documentation, the default Java version on Circle CI
is Java 8.
The project is set as a Java 7 project. We define to use OpenJDK 7,
because the Gitblit build has some trouble with Java 8, I consider
Java 7 the default, and Circle CI does not provide an Oracle JDK 7
installation to use. I could only get it to work with OpenJDK 7.

The Java version is reported in the Circle CI build script to ease
analysis.

Test and coverage reports get stored as artifacts for a build, which
allows to browse them in the Circle CI web interface.

7 years agoAdd definition file for Travis CI
Florian Zschocke [Mon, 12 Dec 2016 12:34:17 +0000 (13:34 +0100)]
Add definition file for Travis CI

Add the most basic build definition file for Travis CI. It only
defines the project language as Java. For the rest the defaults
are kept as Travis seems to work fine with them.
We add `.travis.yml` as a dotfile in order not to clutter the
top directory with too much non-project files.

7 years agoupdated comment
de4c9d [Fri, 30 Dec 2016 17:19:58 +0000 (18:19 +0100)]
updated comment

7 years agoupdate user manager to support instantiation if IUserService with IRuntimeManager...
de4c9d [Fri, 30 Dec 2016 16:09:16 +0000 (17:09 +0100)]
update user manager to support instantiation if IUserService with IRuntimeManager as a parameter

7 years agoUpdate to explicit versions of JUnit 4.12 and JaCoCo 0.7.8
Florian Zschocke [Wed, 21 Dec 2016 21:02:46 +0000 (22:02 +0100)]
Update to explicit versions of JUnit 4.12 and JaCoCo 0.7.8

Use explicit coordinates, and therefor version numbers fro JUnit
in the build.moxie file. It should not be some version that just
happens to be used.

Update JUnit to latest 4.12.
Update JaCoCo to lates 0.7.8, which makes it work under Java 8.
The last used version would fail when tests are run under Java 8.

7 years agoAdd test resources path `src/test/resources` to project configuration
Florian Zschocke [Mon, 19 Dec 2016 09:08:42 +0000 (10:08 +0100)]
Add test resources path `src/test/resources` to project configuration

7 years agoFix typo in defaults.properties.
Florian Zschocke [Fri, 16 Dec 2016 12:36:43 +0000 (13:36 +0100)]
Fix typo in defaults.properties.

7 years agoMerge pull request #1160 from fzs/sshLdapAuthenticator
Florian Zschocke [Sun, 18 Dec 2016 16:01:15 +0000 (17:01 +0100)]
Merge pull request #1160 from fzs/sshLdapAuthenticator

LDAP SSH key manager

7 years agoRemove duplicate import of class SecureRandom
Florian Zschocke [Thu, 15 Dec 2016 19:28:37 +0000 (20:28 +0100)]
Remove duplicate import of class SecureRandom

Fixes the build that was broken by cherry-picking commit 2be2c2,
which resulted in an import collision on the `SecureRandom` class.

7 years agoMerge pull request #1167 from fzs/secureCookies
James Moger [Wed, 14 Dec 2016 22:01:10 +0000 (17:01 -0500)]
Merge pull request #1167 from fzs/secureCookies

Secure cookies

7 years agoMerge branch 'rcaa-master' into master.
Florian Zschocke [Tue, 13 Dec 2016 15:56:59 +0000 (16:56 +0100)]
Merge branch 'rcaa-master' into master.

7 years agoMerge branch 'fixMentionsInTickets-985'
Florian Zschocke [Mon, 12 Dec 2016 21:59:12 +0000 (22:59 +0100)]
Merge branch 'fixMentionsInTickets-985'

7 years agoIntroduce SecureRandom wrapper for properly seeded static instances
Florian Zschocke [Sat, 10 Dec 2016 00:00:27 +0000 (01:00 +0100)]
Introduce SecureRandom wrapper for properly seeded static instances

Introduce our own wrapper `SecureRandom` around `java.security.SecureRandom`.
This a) makes sure that the PRNG is seeded on creation and not when
random bytes are retrieved, and
b) uses a static instance in the `UserModel` so that lags do not occur
during operation due to potentially seeding getting blocked on Unix
when reading from the system's entropy pool. To keep the random data
still secure, the static instance will reseed all 24 hours, also a
functionality of the wrapper class.

This fixes #1063 and extends and closes PR #1116

7 years agochanging Math.random to SecureRandom 1116/head
rcaa [Sun, 11 Dec 2016 22:12:27 +0000 (19:12 -0300)]
changing Math.random to SecureRandom

7 years agoFix user mention regular expression and group replacement. merged--fixMentionsInTickets-985
Florian Zschocke [Sat, 10 Dec 2016 15:02:21 +0000 (16:02 +0100)]
Fix user mention regular expression and group replacement.

The regular expression used for user mentions used to work
only inside sentences. Also, since it tested for whitespace, the
whitespace would get replaced, too, which would join lines together.

Instead the new regex uses boundary matchers to match against
word boundaires. As these are not capturing only the actual user
mention can be captured and is then replaced. Also, this way the
regex can ignore punctuation like in "@jim, look at this."

Since Gibtlit now requires Java 7 we can use named capture groups.
This makes the use of a centrally defined regular expression much
safer. The (admittedly only) group to capture the user name is named
"user" and can be referenced by this name. By using the name instead
of a group number, the regex could be changed without the code using
it breaking because the group number changed.

A simple test is added for user mentions, which unfortunately
has to deal with the full markdown replacement, too.

Fixes #985

7 years agoUse REGEX_TICKET_MENTION instead of hardcoded regular expression
Glenn Matthys [Fri, 8 Jan 2016 11:48:47 +0000 (12:48 +0100)]
Use REGEX_TICKET_MENTION instead of hardcoded regular expression

7 years agoIntroduce new constant REGEX_TICKET_MENTION
Glenn Matthys [Fri, 8 Jan 2016 11:48:21 +0000 (12:48 +0100)]
Introduce new constant REGEX_TICKET_MENTION

7 years agoSet secure session cookies when redirecting from HTTP to HTTPS. 1167/head merged--secureCookies
Florian Zschocke [Sat, 10 Dec 2016 10:30:28 +0000 (11:30 +0100)]
Set secure session cookies when redirecting from HTTP to HTTPS.

So far for session cookies the secure property was only set when no
HTTP port was opened. This changes to also set it when HTTP is redirected
to the HTTPS port.

7 years agoSet secure user cookies and only for HTTP.
Florian Zschocke [Sat, 10 Dec 2016 09:57:45 +0000 (10:57 +0100)]
Set secure user cookies and only for HTTP.

Mark the user authentication cookie to be only used for HTTP, making
it inaccessible for JavaScript engines.

If only HTTPS is used and no HTTP (i.e. also if HTTP is redirected to
HTTPS) then mark the user cookie to be sent only over secure connections.

7 years agoExtend documentation in default.properties and LdapKeyManager.java. 1160/head merged--sshLdapAuthenticator
Florian Zschocke [Mon, 5 Dec 2016 14:58:06 +0000 (15:58 +0100)]
Extend documentation in default.properties and LdapKeyManager.java.

7 years agoThe public key manager can disable writing keys, which hides commands
Florian Zschocke [Tue, 29 Nov 2016 21:08:50 +0000 (22:08 +0100)]
The public key manager can disable writing keys, which hides commands

Some public key mangers may be read-only, i.e. not allow to add or
delete keys, or to change the key comment or assigned permissions.
In such a case the respective commands should not be available on the
SSH shell and the SSH Keys panel should also not offer the possibility.

The `IPublicKeyManager` gets three new methods, modelled after the
`AuthenticationManager`:
`supportsWritingKeys`, `supportsCommentChanges` and
`supportsPermissionChanges`. They return true if a key manager allows for
keys to be written or updated.
For example the existing `FileKeyManager` will return true for all three
since it allows to store and update keys in a file.
The new `LdapKeyManager` returns false since it only accesses LDAP and
can not add or update any keys in the directory.
A future key manager might get keys from an LDAP directory but still
keep comments and permissions for it in a local copy.

If writing of keys is not supported:
* the welcome shell does not suggest adding a key,
* the `SshKeysDispatcher` does not offer the "add", "remove", "comment" and
  "permission" commands, and
* the SSH keys panel hides the "delete" button in the key list, and the
  "Add Key" form.

The hiding of the "Add key" form is not perfect since the surrounding
div is still shown, but I don't know how to hide it and it didn't look
too bad, either.

7 years agoFix SshKeysDispatcher test failing on Windows
Florian Zschocke [Tue, 29 Nov 2016 20:46:54 +0000 (21:46 +0100)]
Fix SshKeysDispatcher test failing on Windows

The `SshKeysDispatcher` tests that use the keys list command are failing
on Windows because they assume a Unix line ending after each key. But
the command will use a system line ending. So this fix uses system line
endings in the reference string for the assert, too.

In addition, two `assertTrue(false)´ are replaced with a proper `fail`.

7 years agoUse dynamic port selection for LDAP listeners in LDAP tests.
Florian Zschocke [Sat, 26 Nov 2016 16:35:21 +0000 (17:35 +0100)]
Use dynamic port selection for LDAP listeners in LDAP tests.

Instead of using fixed ports for the listeners of the in-memory
LDAP server, let the listeners select ports and then save them in
the authentication mode instance. This way we prevent port collisions,
which especially showed up under Windows.

7 years agoSet list of offered SSH authentication methods. 1159/head merged--sshAuthMethods
Florian Zschocke [Tue, 6 Dec 2016 13:44:18 +0000 (14:44 +0100)]
Set list of offered SSH authentication methods.

Make the SSH authentication methods used by the server configurable,
so that for example password authentication can be turned off.

For this, a `git.sshAuthenticationMethods` setting is added which is a space
separated list of authentication method names. Only the methods listed will
be enabled in the server.
This is modeled after the option of the same name from sshd_config, but it
does not offer listing multiple required methods. It leaves the door open,
though, for a later extension to support such a multi-factor authentication.

Since this also includes Kerberos authentication with GSS API, this obsoletes
the `git.sshWithKrb5` property. The latter is removed. Instead, to enable
Kerberos5 authentication, add the method name `gssapi-with-mic` to the
authentication methods list.

7 years agoRetrieve public SSH keys from LDAP.
Florian Zschocke [Fri, 25 Nov 2016 17:21:27 +0000 (18:21 +0100)]
Retrieve public SSH keys from LDAP.

Add new class `LdapPublicKeyManager` which retrieves public SSH keys
from LDAP.

The attribute can be configured with the new configuration option
`realm.ldap.sshPublicKey`. The setting can be a simple attribute name,
like `sshPublicKey`, or an attribute name and a prefix for the value,
like `altSecurityIdentities:SshKey`, in which case attributes are selected
that have the name `altSecurityIdentities` and whose values start with
`SshKey:`.

7 years agoExtract LdapConnection into new class from LdapAuthProvider
Florian Zschocke [Wed, 23 Nov 2016 01:59:39 +0000 (02:59 +0100)]
Extract LdapConnection into new class from LdapAuthProvider

Extract the inner class `LdapConnection` from the `LdapAuthProvider`
into a separate class, so that it can be used from multiple classes
that have to connect to an LDAP directory.
The new class is placed into the new package `com.gitblit.ldap`, since
it isn't specific to authentication.

7 years agoCreate base unit test class for LDAP tests.
Florian Zschocke [Wed, 23 Nov 2016 01:48:38 +0000 (02:48 +0100)]
Create base unit test class for LDAP tests.

Extract the creation of the in-memory servers and the interceptor
code to a base class that LDAP related unit tests can extend to
have the servers available.

7 years agoMerge pull request #1152 from fzs/fixAdminRoleLDAP
James Moger [Fri, 18 Nov 2016 23:51:20 +0000 (18:51 -0500)]
Merge pull request #1152 from fzs/fixAdminRoleLDAP

Set "can admin" permission on LDAP users and teams correctly

7 years agoSet "can admin" permission on LDAP users and teams correctly 1152/head merged--fixAdminRoleLDAP
Florian Zschocke [Fri, 18 Nov 2016 19:26:06 +0000 (20:26 +0100)]
Set "can admin" permission on LDAP users and teams correctly

The canAdmin permission is set on a LDAP user, when the user is listed
in `realm.ldap.admins` or is a member of a team listed in `realm.ldap.admins`.
This leads to inconsistent and surprising behaviour on the EditUser page
when clicking the "can admin" checkbox. Also, the "can admin" checkbox
is disabled, but not checked, for teams that are listed as admin teams.

The new behaviour implemented in this patch makes users and teams from
LDAP match local ones. That means:
* LDAP teams that are listed in `realm.ldap.admins` get the canAdmin
  property set if teams are maintained in LDAP.
* LDAP users that are listed in `realm.ldap.admins` get the canAdmin
  property set if teams are maintained in LDAP.
* LDAP users do not get the canAdmin property set, if they are only a
  member of a team listed in `realm.ldap.admins`.
* The `supportsRoleChanges` method for users and teams of the
  `LdapAuthProvider` unconditially returns false if teams are
  maintained in LDAP, not only for users and teams listed in
  `realm.ldap.admins`.
* Therefore, for all LDAP users and teams the "can admin" checkbox
  is always disabled if teams are maintained in LDAP.

7 years agoMerge pull request #1147 from tomaswolf/disabled_pager_links
James Moger [Mon, 14 Nov 2016 22:44:21 +0000 (17:44 -0500)]
Merge pull request #1147 from tomaswolf/disabled_pager_links

Fix disabled links in PagerPanel

7 years agoMerge pull request #1149 from fzs/fixLDAPbinding
James Moger [Mon, 14 Nov 2016 22:42:10 +0000 (17:42 -0500)]
Merge pull request #1149 from fzs/fixLDAPbinding

Fix LDAP binding strategies

7 years agoUpdate documentation for LDAP binding in default.properties. 1149/head merged--fixLDAPbinding
Florian Zschocke [Mon, 14 Nov 2016 19:18:07 +0000 (20:18 +0100)]
Update documentation for LDAP binding in default.properties.

Extend the comments for some realm.ldap.* properties to better explain
use cases and requirements.

7 years agoClean up `LdapAuthProvider` to properly cover different LDAP search scenarios.
Florian Zschocke [Fri, 11 Nov 2016 18:22:17 +0000 (19:22 +0100)]
Clean up `LdapAuthProvider` to properly cover different LDAP search scenarios.

Gitblit allows in its configuration to set a "manager" user (and password) which can be used
to search for the entry of a user wanting to log in. If they are both not set, an anonymous search
is attempted. In the description below, when I say "...as manager", it is either as manager or
anonymous.
So far the behaviour of Gitblit, with respect to binding to and searching in LDAP,
has been the following when a user logs in:

**bind as manager**
**search for the user**
_bind as the user_
_search for the teams_

I'll call this code flow A.

Later an additional configuration option had been added: `realm.ldap.bindpattern`.
(PR gitblit/gitblit#162) It was meant to allow for not using a manager nor anonymous binds,
by searching the directory as the user logging in.
This is done in code flow B:

**bind as manager**
_bind as user_
_search for user_
_search for teams_

Both A and B are flawed, I think. In A, it looks like a mistake to me that the binding stays with the
user after authentication. The problem that this causes is, that in LDAP server configurations
where normal users are not allowed to read groups, the team information cannot be retrieved.
I tried but failed to understand how B is supposed to work. There will always be a bind request
as either anonymous or the manager DN when the LDAP connection is created. If neither is
possible, the authentication process will fail and the user cannot log in.

When synchronizing users and teams from LDAP, the following code flow is exercised:

F:
**bind as manager**
**search for users**
**search for teams**

This patch fixes both code flows by introducing a new flow.

C:
**bind as manager**
**search for user**
_bind as user to authenticate_
**bind as manager**
**search for teams**

And it changes code flow B to the following code flow D:

_bind as user_
_search for user_
_search for teams_

With code flows A, C, D and F the following usage (and authentication) scenarios are covered.
They are described from the view of a Gitblit administrator's intent and his LDAP setup.

* Users and team should be snychronized with LDAP
This means anonymous or a fixed account must be able to read users and groups.
=> covered by C and F

As the above allows for authentication and is required for synchronisation, all the others below
do not cover synchronization.

* No anonymous binding allowed and no special manager binding required
This means that users must be able to read user an group entries.
=> covered by D

* The user DN needs to be searched, e.g. because they are not all under the same parent DN.
This means that anonymous or a fixed account must be able to read users.
-- anonymous or the "manager" account can also read groups
=> covered by C
-- anonymous or the "manager" account cannot read groups but a user can
=> covered by A

I therefore believe that the new code will cover all common use cases. The implementation
either directly binds as the user, when `bindpattern` is not empty, or it binds anonymous or
against the manger DN to search for the user DN entry.

If it directly bound against the user DN, the user is already authenticated. It will then only check
that the user DN it found in the search is identical to the one it is currently bound against. If it
was bound against a manager DN (or anonymously) it will bind against the found user DN to
authenticate the user logging in, and will then rebind against the manager DN.

When searching for groups in LDAP, if the search fails with a result code other than SUCCESS,
the implementation will bind against the user DN, if it isn't already bound against it. It will then
repeat the search for groups under the user authorization. This is to keep backwards
compatible with the original behaviour A, in order to not break cases where the LDAP setup
would deny a manager account to search for groups but allow it for normal users.

To achieve this the implementation introduces an internal `LdapConnection` class that wraps
the connection and keeps bind state, so that a rebind as a user is possible.
This also fixes a resource leak where the connection was not closed in case that the initial bind
as the manager account did not succeed.

This commit would fix gitblit/gitblit#920

7 years agoExtend LDAP tests to use LDAP servers with access restrictions.
Florian Zschocke [Wed, 9 Nov 2016 21:04:00 +0000 (22:04 +0100)]
Extend LDAP tests to use LDAP servers with access restrictions.

Add access restrictions to the LDAP test server instances.
New modes used a test parameters are ANONYMOUS, DS_MANAGER and USR_MANAGER.
ANONYMOUS can bind anonymously and access users and groups.
In DS_MANAGER the server requires authentication and will only allow
the DIRECTORY_MANAGER user to search for users and groups.
In USR_MANAGER only the user can search groups, the USER_MANAGER, which
is used to bind in this mode, can not.

A third server instance is created because I did fear side effects should
the tests be run in parallel, had I tried to configure the access
restriction in Before.

7 years agoExtend LDAP authentication tests to use different modes.
Florian Zschocke [Sun, 6 Nov 2016 17:09:32 +0000 (18:09 +0100)]
Extend LDAP authentication tests to use different modes.

Instantiate two LDAP servers, one that allows anonymous access, and
one that requires authentication for all operations.
The JUnit test is parameterized to run all tests with both instances.
It uses different settings for each mode.

7 years agoFix disabled links in PagerPanel 1147/head
Tom [Mon, 31 Oct 2016 06:50:26 +0000 (07:50 +0100)]
Fix disabled links in PagerPanel

Disabled links in the PagerPanel (used on the LuceneSearchPage to page
through search results) were only rendered as "disabled". The links
themselves remained active, which gives strange effects when clicked.
For instance it was possible to move to result pages -1, -2, and so on.

Really disable the links. Add missing CSS rules to have correct styling
as Wicket renders disabled links as spans, not anchors. Include the new
CSS file in BasePage.html. And add the left/right arrows only if not on
the first/last page.

7 years agoMerge pull request #1144 from fzs/logSendFailedException
James Moger [Fri, 28 Oct 2016 20:05:46 +0000 (16:05 -0400)]
Merge pull request #1144 from fzs/logSendFailedException

Improve logging when sending email fails.

7 years agoMerge pull request #1142 from fzs/merge-strategy
James Moger [Fri, 28 Oct 2016 20:04:40 +0000 (16:04 -0400)]
Merge pull request #1142 from fzs/merge-strategy

Merge strategy

7 years agoAdd merge type setting to repository page. 1142/head merged--merge-strategy
Florian Zschocke [Mon, 23 Jun 2014 02:12:19 +0000 (04:12 +0200)]
Add merge type setting to repository page.

The merge type is a per repository setting. Add it to the edit page.

7 years agoAdd integration strategy to merge tickes fast-forward or with commit.
Florian Zschocke [Sat, 21 Jun 2014 00:53:21 +0000 (02:53 +0200)]
Add integration strategy to merge tickes fast-forward or with commit.

Add the option to merge a ticket branch to the integration branch
only when it can be fast-forwarded, or
always with a merge commit, or
by fast-foward if possible, otherwise with a merge commit.

Adds a new property ticket.mergeType with the valid values
FAST_FOWARD_ONLY, MERGE_ALWAYS and MERGE_IF_NECESSARY.

Merging and canMerge were refactored to make use of a new
IntegrationStrategy class for each type of strategy.

7 years agoImprove logging when sending email fails. 1144/head merged-logSendFailedException
Florian Zschocke [Tue, 18 Nov 2014 22:53:33 +0000 (23:53 +0100)]
Improve logging when sending email fails.

7 years agoMerge pull request #1140 from tomaswolf/issue_1076
James Moger [Thu, 27 Oct 2016 14:52:33 +0000 (10:52 -0400)]
Merge pull request #1140 from tomaswolf/issue_1076

Issue #1076: load commit cache in a background thread

7 years agoIssue #1076: load commit cache in a background thread 1140/head
Tom [Wed, 26 Oct 2016 19:37:19 +0000 (21:37 +0200)]
Issue #1076: load commit cache in a background thread

* Make the CommitCache fully thread-safe. It was using a
  ConcurrentHashMap containing lists, but then handed out these lists.
  It also did multiple operations on that map that as a whole should
  be atomic.

* Use isEmpty() instead of size() == 0.

* Run the loading of the commit cache in a background daemon thread

8 years agoMerge pull request #1130 from larsmaes/patch-2
James Moger [Fri, 16 Sep 2016 18:24:20 +0000 (14:24 -0400)]
Merge pull request #1130 from larsmaes/patch-2

Spelling mistake fix

8 years agoSpelling mistake fix 1130/head
larsmaes [Fri, 16 Sep 2016 13:25:08 +0000 (15:25 +0200)]
Spelling mistake fix

pushedNewBranch was wrongly spelled

8 years agoremoving unecessary user cookie code
Rodrigo Andrade [Mon, 15 Aug 2016 21:24:24 +0000 (18:24 -0300)]
removing unecessary user cookie code

8 years agoremoving duplicated code for cookie genaration and adding random bytes to generate...
Rodrigo Andrade [Mon, 15 Aug 2016 21:20:28 +0000 (18:20 -0300)]
removing duplicated code for cookie genaration and adding random bytes to generate user cookies

8 years agoMerge pull request #1110 from WilliamFromTW/master
James Moger [Fri, 5 Aug 2016 12:33:31 +0000 (08:33 -0400)]
Merge pull request #1110 from WilliamFromTW/master

1.8.x tranditional chinese translation

8 years ago1.8.x tranditional chinese translation 1110/head
william [Thu, 4 Aug 2016 07:47:48 +0000 (15:47 +0800)]
1.8.x tranditional chinese translation

8 years ago1.8.x tranditional chinese translation after user experience 1109/head
william [Thu, 4 Aug 2016 06:07:34 +0000 (14:07 +0800)]
1.8.x tranditional chinese translation after user experience

8 years agoMerge pull request #1105 from guilliamxavier/patch-1
James Moger [Fri, 29 Jul 2016 15:10:00 +0000 (11:10 -0400)]
Merge pull request #1105 from guilliamxavier/patch-1

Fix &rt; to > in mail (in rename status line)

8 years agoFix &rt; to > in mail (in rename status line) 1105/head
Guilliam Xavier [Fri, 29 Jul 2016 08:36:58 +0000 (10:36 +0200)]
Fix &rt; to > in mail (in rename status line)

fixes #1104

8 years agoReset build identifiers for next point release cycle
James Moger [Wed, 22 Jun 2016 19:07:52 +0000 (15:07 -0400)]
Reset build identifiers for next point release cycle

8 years agoPrepare 1.8.0 release v1.8.0
James Moger [Wed, 22 Jun 2016 18:50:46 +0000 (14:50 -0400)]
Prepare 1.8.0 release

8 years agoUpdate documentation for 1.8.0 release
James Moger [Wed, 22 Jun 2016 18:45:55 +0000 (14:45 -0400)]
Update documentation for 1.8.0 release

8 years agoMerge pull request #1087 from mereth/issues/964-session-loss-redirects-to-start-page
Paul Martin [Sun, 19 Jun 2016 13:08:19 +0000 (14:08 +0100)]
Merge pull request #1087 from mereth/issues/964-session-loss-redirects-to-start-page

Fixes #964 - add missing redirect after restoring user in new session