merge changes from version 1.17

This commit is contained in:
Sebastian Sdorra
2012-07-23 09:11:41 +02:00
218 changed files with 14848 additions and 821 deletions

View File

@@ -46,6 +46,8 @@ import sonia.scm.group.GroupListener;
import sonia.scm.io.FileSystem;
import sonia.scm.plugin.ext.Extension;
import sonia.scm.plugin.ext.ExtensionProcessor;
import sonia.scm.repository.BlameLinePreProcessor;
import sonia.scm.repository.BlameLinePreProcessorFactory;
import sonia.scm.repository.ChangesetPreProcessor;
import sonia.scm.repository.ChangesetPreProcessorFactory;
import sonia.scm.repository.FileObjectPreProcessor;
@@ -54,6 +56,7 @@ import sonia.scm.repository.RepositoryHandler;
import sonia.scm.repository.RepositoryHook;
import sonia.scm.repository.RepositoryListener;
import sonia.scm.repository.RepositoryRequestListener;
import sonia.scm.repository.spi.RepositoryServiceResolver;
import sonia.scm.resources.ResourceHandler;
import sonia.scm.security.EncryptionHandler;
import sonia.scm.user.UserListener;
@@ -124,6 +127,16 @@ public class BindingExtensionProcessor implements ExtensionProcessor
Multibinder<FileObjectPreProcessorFactory> fileObjectPreProcessorFactoryBinder =
Multibinder.newSetBinder(binder, FileObjectPreProcessorFactory.class);
// blameline pre processor
Multibinder<BlameLinePreProcessor> blameLinePreProcessorBinder =
Multibinder.newSetBinder(binder, BlameLinePreProcessor.class);
Multibinder<BlameLinePreProcessorFactory> blameLinePreProcessorFactoryBinder =
Multibinder.newSetBinder(binder, BlameLinePreProcessorFactory.class);
// repository service resolver
Multibinder<RepositoryServiceResolver> repositoryServiceResolverBinder =
Multibinder.newSetBinder(binder, RepositoryServiceResolver.class);
// listeners
Multibinder<RepositoryListener> repositoryListenerBinder =
Multibinder.newSetBinder(binder, RepositoryListener.class);
@@ -268,6 +281,27 @@ public class BindingExtensionProcessor implements ExtensionProcessor
fileObjectPreProcessorFactoryBinder.addBinding().to(extensionClass);
}
else if (BlameLinePreProcessor.class.isAssignableFrom(extensionClass))
{
if (logger.isInfoEnabled())
{
logger.info("bind BlameLinePreProcessor {}",
extensionClass.getName());
}
blameLinePreProcessorBinder.addBinding().to(extensionClass);
}
else if (BlameLinePreProcessorFactory.class.isAssignableFrom(
extensionClass))
{
if (logger.isInfoEnabled())
{
logger.info("bind BlameLinePreProcessorFactory {}",
extensionClass.getName());
}
blameLinePreProcessorFactoryBinder.addBinding().to(extensionClass);
}
else if (RepositoryHook.class.isAssignableFrom(extensionClass))
{
if (logger.isInfoEnabled())
@@ -297,6 +331,16 @@ public class BindingExtensionProcessor implements ExtensionProcessor
servletContextListenerBinder.addBinding().to(extensionClass);
}
else if (RepositoryServiceResolver.class.isAssignableFrom(extensionClass))
{
if (logger.isInfoEnabled())
{
logger.info("bind RepositoryServiceResolver {}",
extensionClass.getName());
}
repositoryServiceResolverBinder.addBinding().to(extensionClass);
}
else
{
if (logger.isInfoEnabled())

View File

@@ -71,6 +71,7 @@ import sonia.scm.repository.RepositoryBrowserUtil;
import sonia.scm.repository.RepositoryDAO;
import sonia.scm.repository.RepositoryManager;
import sonia.scm.repository.RepositoryProvider;
import sonia.scm.repository.api.RepositoryServiceFactory;
import sonia.scm.repository.xml.XmlRepositoryDAO;
import sonia.scm.resources.DefaultResourceManager;
import sonia.scm.resources.DevelopmentResourceManager;
@@ -101,6 +102,7 @@ import sonia.scm.util.DebugServlet;
import sonia.scm.util.ScmConfigurationUtil;
import sonia.scm.web.cgi.CGIExecutorFactory;
import sonia.scm.web.cgi.DefaultCGIExecutorFactory;
import sonia.scm.web.filter.LoggingFilter;
import sonia.scm.web.security.AdministrationContext;
import sonia.scm.web.security.ApiBasicAuthenticationFilter;
import sonia.scm.web.security.AuthenticationManager;
@@ -172,6 +174,9 @@ public class ScmServletModule extends ServletModule
/** Field description */
public static final String REST_PACKAGE = "sonia.scm.api.rest";
/** Field description */
public static final String SYSTEM_PROPERTY_DEBUG_HTTP = "scm.debug.http";
/** Field description */
public static final String[] PATTERN_STATIC_RESOURCES = new String[] {
PATTERN_SCRIPT,
@@ -299,6 +304,15 @@ public class ScmServletModule extends ServletModule
Names.named(UrlProviderFactory.TYPE_WUI)).toProvider(
WebUIUrlProvider.class);
// bind repository service factory
bind(RepositoryServiceFactory.class);
// bind debug logging filter
if ("true".equalsIgnoreCase(System.getProperty(SYSTEM_PROPERTY_DEBUG_HTTP)))
{
filter(PATTERN_ALL).through(LoggingFilter.class);
}
/*
* filter(PATTERN_PAGE,
* PATTERN_STATIC_RESOURCES).through(StaticResourceFilter.class);

View File

@@ -39,9 +39,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.PathNotFoundException;
import sonia.scm.repository.RepositoryBrowser;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.api.CatCommandBuilder;
//~--- JDK imports ------------------------------------------------------------
@@ -71,13 +71,13 @@ public class BrowserStreamingOutput implements StreamingOutput
*
* @param browser
* @param revision
*
* @param builder
* @param path
*/
public BrowserStreamingOutput(RepositoryBrowser browser, String revision,
String path)
public BrowserStreamingOutput(CatCommandBuilder builder, String path)
{
this.browser = browser;
this.revision = revision;
this.builder = builder;
this.path = path;
}
@@ -98,7 +98,7 @@ public class BrowserStreamingOutput implements StreamingOutput
{
try
{
browser.getContent(revision, path, output);
builder.retriveContent(output, path);
}
catch (PathNotFoundException ex)
{
@@ -130,11 +130,8 @@ public class BrowserStreamingOutput implements StreamingOutput
//~--- fields ---------------------------------------------------------------
/** Field description */
private RepositoryBrowser browser;
private CatCommandBuilder builder;
/** Field description */
private String path;
/** Field description */
private String revision;
}

View File

@@ -38,10 +38,10 @@ package sonia.scm.api.rest.resources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.DiffViewer;
import sonia.scm.repository.PathNotFoundException;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.api.DiffCommandBuilder;
//~--- JDK imports ------------------------------------------------------------
@@ -66,19 +66,14 @@ public class DiffStreamingOutput implements StreamingOutput
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
* Constructs ...
*
*
* @param diffViewer
* @param revision
* @param path
* @param builder
*/
public DiffStreamingOutput(DiffViewer diffViewer, String revision,
String path)
public DiffStreamingOutput(DiffCommandBuilder builder)
{
this.diffViewer = diffViewer;
this.revision = revision;
this.path = path;
this.builder = builder;
}
//~--- methods --------------------------------------------------------------
@@ -98,7 +93,7 @@ public class DiffStreamingOutput implements StreamingOutput
{
try
{
diffViewer.getDiff(revision, path, output);
builder.retriveContent(output);
}
catch (PathNotFoundException ex)
{
@@ -130,11 +125,5 @@ public class DiffStreamingOutput implements StreamingOutput
//~--- fields ---------------------------------------------------------------
/** Field description */
private DiffViewer diffViewer;
/** Field description */
private String path;
/** Field description */
private String revision;
private DiffCommandBuilder builder;
}

View File

@@ -35,6 +35,8 @@ package sonia.scm.api.rest.resources;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Strings;
import com.google.common.io.Closeables;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -45,30 +47,30 @@ import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.NotSupportedFeatuerException;
import sonia.scm.config.ScmConfiguration;
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.BlameViewerUtil;
import sonia.scm.repository.BrowserResult;
import sonia.scm.repository.Changeset;
import sonia.scm.repository.ChangesetPagingResult;
import sonia.scm.repository.ChangesetViewerUtil;
import sonia.scm.repository.DiffViewer;
import sonia.scm.repository.Permission;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.PermissionUtil;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryBrowser;
import sonia.scm.repository.RepositoryBrowserUtil;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RepositoryHandler;
import sonia.scm.repository.RepositoryIsNotArchivedException;
import sonia.scm.repository.RepositoryManager;
import sonia.scm.repository.RepositoryNotFoundException;
import sonia.scm.repository.RepositoryUtil;
import sonia.scm.repository.api.BlameCommandBuilder;
import sonia.scm.repository.api.BrowseCommandBuilder;
import sonia.scm.repository.api.CatCommandBuilder;
import sonia.scm.repository.api.CommandNotSupportedException;
import sonia.scm.repository.api.DiffCommandBuilder;
import sonia.scm.repository.api.LogCommandBuilder;
import sonia.scm.repository.api.RepositoryService;
import sonia.scm.repository.api.RepositoryServiceFactory;
import sonia.scm.security.ScmSecurityException;
import sonia.scm.util.AssertUtil;
import sonia.scm.util.HttpUtil;
import sonia.scm.util.Util;
import sonia.scm.web.security.WebSecurityContext;
@@ -125,6 +127,7 @@ public class RepositoryResource
* @param configuration
* @param repositoryManager
* @param securityContextProvider
* @param servicefactory
* @param changesetViewerUtil
* @param repositoryBrowserUtil
* @param blameViewerUtil
@@ -133,17 +136,13 @@ public class RepositoryResource
public RepositoryResource(
ScmConfiguration configuration, RepositoryManager repositoryManager,
Provider<WebSecurityContext> securityContextProvider,
ChangesetViewerUtil changesetViewerUtil,
RepositoryBrowserUtil repositoryBrowserUtil,
BlameViewerUtil blameViewerUtil)
RepositoryServiceFactory servicefactory)
{
super(repositoryManager);
this.configuration = configuration;
this.repositoryManager = repositoryManager;
this.servicefactory = servicefactory;
this.securityContextProvider = securityContextProvider;
this.changesetViewerUtil = changesetViewerUtil;
this.repositoryBrowserUtil = repositoryBrowserUtil;
this.blameViewerUtil = blameViewerUtil;
setDisableCache(false);
}
@@ -349,13 +348,21 @@ public class RepositoryResource
throws RepositoryException, IOException
{
Response response = null;
RepositoryService service = null;
try
{
AssertUtil.assertIsNotNull(path);
service = servicefactory.create(id);
BlameResult blamePagingResult = blameViewerUtil.getBlame(id, revision,
path);
BlameCommandBuilder builder = service.getBlameCommand();
if (!Strings.isNullOrEmpty(revision))
{
builder.setRevision(revision);
}
BlameResult blamePagingResult = builder.getBlameResult(path);
if (blamePagingResult != null)
{
@@ -374,10 +381,14 @@ public class RepositoryResource
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (NotSupportedFeatuerException ex)
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
finally
{
Closeables.closeQuietly(service);
}
return response;
}
@@ -413,11 +424,25 @@ public class RepositoryResource
throws RepositoryException, IOException
{
Response response = null;
RepositoryService service = null;
try
{
BrowserResult result = repositoryBrowserUtil.getResult(id, revision,
path);
service = servicefactory.create(id);
BrowseCommandBuilder builder = service.getBrowseCommand();
if (!Strings.isNullOrEmpty(revision))
{
builder.setRevision(revision);
}
if (!Strings.isNullOrEmpty(path))
{
builder.setPath(path);
}
BrowserResult result = builder.getBrowserResult();
if (result != null)
{
@@ -432,10 +457,14 @@ public class RepositoryResource
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (NotSupportedFeatuerException ex)
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
finally
{
Closeables.closeQuietly(service);
}
return response;
}
@@ -511,9 +540,13 @@ public class RepositoryResource
if (Util.isNotEmpty(id) && Util.isNotEmpty(revision))
{
RepositoryService service = null;
try
{
Changeset changeset = changesetViewerUtil.getChangeset(id, revision);
service = servicefactory.create(id);
Changeset changeset = service.getLogCommand().getChangeset(revision);
if (changeset != null)
{
@@ -528,10 +561,14 @@ public class RepositoryResource
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (NotSupportedFeatuerException ex)
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
finally
{
Closeables.closeQuietly(service);
}
}
else
{
@@ -581,21 +618,29 @@ public class RepositoryResource
@QueryParam("limit") int limit) throws RepositoryException, IOException
{
Response response = null;
RepositoryService service = null;
try
{
ChangesetPagingResult changesets = null;
if (Util.isEmpty(path))
service = servicefactory.create(id);
LogCommandBuilder builder = service.getLogCommand();
if (!Strings.isNullOrEmpty(path))
{
changesets = changesetViewerUtil.getChangesets(id, start, limit);
builder.setPath(path);
}
else
if (!Strings.isNullOrEmpty(revision))
{
changesets = changesetViewerUtil.getChangesets(id, path, revision,
start, limit);
builder.setStartChangeset(revision);
}
changesets =
builder.setPagingStart(start).setPagingLimit(limit).getChangesets();
if (changesets != null)
{
response = Response.ok(changesets).build();
@@ -609,10 +654,14 @@ public class RepositoryResource
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (NotSupportedFeatuerException ex)
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
finally
{
Closeables.closeQuietly(service);
}
return response;
}
@@ -645,37 +694,43 @@ public class RepositoryResource
{
Response response = null;
StreamingOutput output = null;
Repository repository = repositoryManager.get(id);
RepositoryService service = null;
if (repository != null)
try
{
try
service = servicefactory.create(id);
CatCommandBuilder builder = service.getCatCommand();
if (!Strings.isNullOrEmpty(revision))
{
RepositoryBrowser browser =
repositoryManager.getRepositoryBrowser(repository);
if (browser != null)
{
output = new BrowserStreamingOutput(browser, revision, path);
String contentDispositionName =
getContentDispositionNameFromPath(path);
response = Response.ok(output).header("Content-Disposition",
contentDispositionName).build();
}
else if (logger.isWarnEnabled())
{
logger.warn("could not find repository browser for respository {}",
repository.getId());
response = Response.status(Response.Status.NOT_FOUND).build();
}
}
catch (Exception ex)
{
logger.error("could not retrive content", ex);
response = createErrorResonse(ex);
builder.setRevision(revision);
}
output = new BrowserStreamingOutput(builder, path);
String contentDispositionName = getContentDispositionNameFromPath(path);
response = Response.ok(output).header("Content-Disposition",
contentDispositionName).build();
}
catch (RepositoryNotFoundException ex)
{
logger.warn("could not find repository browser for respository {}", id);
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
catch (Exception ex)
{
logger.error("could not retrive content", ex);
response = createErrorResonse(ex);
}
finally
{
Closeables.closeQuietly(service);
}
return response;
@@ -714,36 +769,49 @@ public class RepositoryResource
AssertUtil.assertIsNotEmpty(id);
AssertUtil.assertIsNotEmpty(revision);
RepositoryService service = null;
Response response = null;
try
{
Repository repository = repositoryManager.get(id);
service = servicefactory.create(id);
if (repository != null)
DiffCommandBuilder builder = service.getDiffCommand();
if (!Strings.isNullOrEmpty(revision))
{
DiffViewer diffViewer = repositoryManager.getDiffViewer(repository);
if (diffViewer != null)
{
String name =
repository.getName().concat("-").concat(revision).concat(".diff");
String contentDispositionName = getContentDispositionName(name);
response = Response.ok(new DiffStreamingOutput(diffViewer, revision,
path)).header("Content-Disposition",
contentDispositionName).build();
}
else
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
builder.setRevision(revision);
}
if (!Strings.isNullOrEmpty(path))
{
builder.setPath(path);
}
String name = service.getRepository().getName().concat("-").concat(
revision).concat(".diff");
String contentDispositionName = getContentDispositionName(name);
response = Response.ok(new DiffStreamingOutput(builder)).header(
"Content-Disposition", contentDispositionName).build();
}
catch (RepositoryNotFoundException ex)
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (CommandNotSupportedException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
catch (Exception ex)
{
logger.error("could not create diff", ex);
response = createErrorResonse(ex);
}
finally
{
Closeables.closeQuietly(service);
}
return response;
}
@@ -909,21 +977,15 @@ public class RepositoryResource
//~--- fields ---------------------------------------------------------------
/** Field description */
private BlameViewerUtil blameViewerUtil;
/** Field description */
private ChangesetViewerUtil changesetViewerUtil;
/** Field description */
private ScmConfiguration configuration;
/** Field description */
private RepositoryBrowserUtil repositoryBrowserUtil;
/** Field description */
private RepositoryManager repositoryManager;
/** Field description */
private Provider<WebSecurityContext> securityContextProvider;
/** Field description */
private RepositoryServiceFactory servicefactory;
}

View File

@@ -1,34 +1,35 @@
/**
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. 2. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
* nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.api.rest.resources;
//~--- non-JDK imports --------------------------------------------------------
@@ -42,7 +43,6 @@ import com.google.inject.Inject;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryManager;
import sonia.scm.repository.RepositoryTypePredicate;
import sonia.scm.repository.RepositoryUtil;
import sonia.scm.template.TemplateHandler;
import sonia.scm.url.UrlProvider;
import sonia.scm.url.UrlProviderFactory;
@@ -116,15 +116,15 @@ public class RepositoryRootResource
@PathParam("type") final String type)
throws IOException
{
UrlProvider uiUrlProvider =
UrlProviderFactory.createUrlProvider(HttpUtil.getCompleteUrl(request),
UrlProviderFactory.TYPE_WUI);
String baseUrl = HttpUtil.getCompleteUrl(request);
UrlProvider uiUrlProvider = UrlProviderFactory.createUrlProvider(baseUrl,
UrlProviderFactory.TYPE_WUI);
//J-
Collection<RepositoryTemplateElement> unsortedRepositories =
Collections2.transform(
Collections2.filter(
repositoryManager.getAll(), new RepositoryTypePredicate(type))
, new RepositoryTransformFunction(request, repositoryManager, uiUrlProvider)
, new RepositoryTransformFunction(uiUrlProvider, baseUrl)
);
List<RepositoryTemplateElement> repositories = Ordering.from(
@@ -160,12 +160,14 @@ public class RepositoryRootResource
*
* @param repository
* @param uiUrlProvider
* @param baseUrl
*/
public RepositoryTemplateElement(Repository repository,
UrlProvider uiUrlProvider)
UrlProvider uiUrlProvider, String baseUrl)
{
this.repository = repository;
this.urlProvider = uiUrlProvider;
this.baseUrl = baseUrl;
}
//~--- get methods --------------------------------------------------------
@@ -236,11 +238,14 @@ public class RepositoryRootResource
*/
public String getUrl()
{
return repository.getUrl();
return repository.createUrl(baseUrl);
}
//~--- fields -------------------------------------------------------------
/** Field description */
private String baseUrl;
/** Field description */
private Repository repository;
@@ -298,14 +303,12 @@ public class RepositoryRootResource
* @param request
* @param repositoryManager
* @param urlProvider
* @param baseUrl
*/
public RepositoryTransformFunction(HttpServletRequest request,
RepositoryManager repositoryManager,
UrlProvider urlProvider)
public RepositoryTransformFunction(UrlProvider urlProvider, String baseUrl)
{
this.request = request;
this.repositoryManager = repositoryManager;
this.urlProvider = urlProvider;
this.baseUrl = baseUrl;
}
//~--- methods ------------------------------------------------------------
@@ -321,18 +324,13 @@ public class RepositoryRootResource
@Override
public RepositoryTemplateElement apply(Repository repository)
{
RepositoryUtil.appendUrl(request, repositoryManager, repository);
return new RepositoryTemplateElement(repository, urlProvider);
return new RepositoryTemplateElement(repository, urlProvider, baseUrl);
}
//~--- fields -------------------------------------------------------------
/** Field description */
private RepositoryManager repositoryManager;
/** Field description */
private HttpServletRequest request;
private String baseUrl;
/** Field description */
private UrlProvider urlProvider;

View File

@@ -1,27 +1,29 @@
/**
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. 2. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
* nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
@@ -38,8 +40,11 @@ import com.google.common.collect.Maps;
import com.google.inject.Inject;
import sonia.scm.SCMContextProvider;
import sonia.scm.Type;
import sonia.scm.config.ScmConfiguration;
import sonia.scm.plugin.PluginManager;
import sonia.scm.repository.RepositoryHandler;
import sonia.scm.repository.RepositoryManager;
import sonia.scm.store.StoreFactory;
import sonia.scm.template.TemplateHandler;
import sonia.scm.util.SecurityUtil;
@@ -50,18 +55,17 @@ import sonia.scm.web.security.WebSecurityContext;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import sonia.scm.Type;
import sonia.scm.repository.RepositoryHandler;
import sonia.scm.repository.RepositoryManager;
/**
*
@@ -87,13 +91,16 @@ public class SupportResource
* @param configuration
* @param pluginManager
* @param storeFactory
* @param repositoryManager
*/
@Inject
public SupportResource(WebSecurityContext securityContext,
SCMContextProvider context,
TemplateHandler templateHandler,
ScmConfiguration configuration,
PluginManager pluginManager, StoreFactory storeFactory, RepositoryManager repositoryManager )
PluginManager pluginManager,
StoreFactory storeFactory,
RepositoryManager repositoryManager)
{
this.securityContext = securityContext;
this.context = context;
@@ -104,8 +111,6 @@ public class SupportResource
this.repositoryManager = repositoryManager;
}
private RepositoryManager repositoryManager;
//~--- get methods ----------------------------------------------------------
/**
@@ -138,15 +143,21 @@ public class SupportResource
return writer.toString();
}
/**
* Method description
*
*
* @return
*/
private List<RepositoryHandler> getRepositoryHandlers()
{
List<RepositoryHandler> handlers = Lists.newArrayList();
for ( Type type : repositoryManager.getConfiguredTypes() )
for (Type type : repositoryManager.getConfiguredTypes())
{
handlers.add( repositoryManager.getHandler(type.getName()) );
handlers.add(repositoryManager.getHandler(type.getName()));
}
return handlers;
}
@@ -259,6 +270,8 @@ public class SupportResource
container = SystemUtil.getServletContainer().name();
java = System.getProperty("java.vendor").concat("/").concat(
System.getProperty("java.version"));
locale = Locale.getDefault().toString();
timeZone = TimeZone.getDefault().getID();
}
//~--- get methods --------------------------------------------------------
@@ -296,6 +309,17 @@ public class SupportResource
return java;
}
/**
* Method description
*
*
* @return
*/
public String getLocale()
{
return locale;
}
/**
* Method description
*
@@ -307,6 +331,17 @@ public class SupportResource
return os;
}
/**
* Method description
*
*
* @return
*/
public String getTimeZone()
{
return timeZone;
}
//~--- fields -------------------------------------------------------------
/** Field description */
@@ -318,8 +353,14 @@ public class SupportResource
/** Field description */
private String java;
/** Field description */
private String locale;
/** Field description */
private String os;
/** Field description */
private String timeZone;
}
@@ -407,6 +448,9 @@ public class SupportResource
/** Field description */
private PluginManager pluginManager;
/** Field description */
private RepositoryManager repositoryManager;
/** Field description */
private WebSecurityContext securityContext;

View File

@@ -39,6 +39,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.SCMContext;
import sonia.scm.SCMContextProvider;
//~--- JDK imports ------------------------------------------------------------
@@ -102,14 +103,16 @@ public class BootstrapListener implements ServletContextListener
@Override
public void contextInitialized(ServletContextEvent sce)
{
SCMContextProvider context = SCMContext.getContext();
if (logger.isInfoEnabled())
{
logger.info("start scm-manager in stage: {}",
SCMContext.getContext().getStage());
logger.info("start scm-manager {} in stage: {}", context.getVersion(),
context.getStage());
}
ClassLoader classLoader = null;
File pluginDirectory = new File(SCMContext.getContext().getBaseDirectory(),
File pluginDirectory = new File(context.getBaseDirectory(),
PLUGIN_DIRECTORY);
if (pluginDirectory.exists())

View File

@@ -0,0 +1,61 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.net;
//~--- JDK imports ------------------------------------------------------------
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
/**
*
* @author Sebastian Sdorra
*/
public class TrustAllHostnameVerifier implements HostnameVerifier
{
/**
* Method description
*
*
* @param hostname
* @param session
*
* @return
*/
@Override
public boolean verify(String hostname, SSLSession session)
{
return true;
}
}

View File

@@ -0,0 +1,88 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.net;
//~--- JDK imports ------------------------------------------------------------
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
/**
*
* @author Sebastian Sdorra
*/
public class TrustAllTrustManager implements X509TrustManager
{
/**
* Method description
*
*
* @param chain
* @param authType
*
* @throws CertificateException
*/
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException {}
/**
* Method description
*
*
* @param chain
* @param authType
*
* @throws CertificateException
*/
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
@Override
public X509Certificate[] getAcceptedIssuers()
{
return null;
}
}

View File

@@ -64,6 +64,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
/**
*
* @author Sebastian Sdorra
@@ -383,6 +387,49 @@ public class URLHttpClient implements HttpClient
}
}
/**
* Method description
*
*
* @param request
* @param connection
*/
private void applySSLSettings(HttpRequest request,
HttpsURLConnection connection)
{
if (request.isDisableCertificateValidation())
{
if (logger.isTraceEnabled())
{
logger.trace("disable certificate validation");
}
try
{
TrustManager[] trustAllCerts = new TrustManager[] {
new TrustAllTrustManager() };
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
connection.setSSLSocketFactory(sc.getSocketFactory());
}
catch (Exception ex)
{
logger.error("could not disable certificate validation", ex);
}
}
if (request.isDisableHostnameValidation())
{
if (logger.isTraceEnabled())
{
logger.trace("disable hostname validation");
}
connection.setHostnameVerifier(new TrustAllHostnameVerifier());
}
}
/**
* Method description
*
@@ -484,9 +531,15 @@ public class URLHttpClient implements HttpClient
private HttpURLConnection openConnection(HttpRequest request, URL url)
throws IOException
{
if (request == null)
{
// TODO improve
request = new HttpRequest(url.toExternalForm());
}
HttpURLConnection connection = null;
if (configuration.isEnableProxy())
if (!request.isIgnoreProxySettings() && configuration.isEnableProxy())
{
if (logger.isDebugEnabled())
{
@@ -506,6 +559,11 @@ public class URLHttpClient implements HttpClient
}
else
{
if (request.isIgnoreProxySettings() && logger.isTraceEnabled())
{
logger.trace("ignore proxy settings");
}
if (logger.isDebugEnabled())
{
logger.debug("fetch '{}'", url.toExternalForm());
@@ -514,6 +572,11 @@ public class URLHttpClient implements HttpClient
connection = (HttpURLConnection) url.openConnection();
}
if (connection instanceof HttpsURLConnection)
{
applySSLSettings(request, (HttpsURLConnection) connection);
}
connection.setReadTimeout(TIMEOUT_RAED);
connection.setConnectTimeout(TIMEOUT_CONNECTION);

View File

@@ -1,34 +1,35 @@
/**
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. 2. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
* nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------

View File

@@ -1,34 +1,35 @@
/**
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. 2. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
* nor the names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.web.cgi;
//~--- non-JDK imports --------------------------------------------------------

View File

@@ -124,9 +124,16 @@ public class BasicSecurityContext implements WebSecurityContext
HttpServletResponse response, String username,
String password)
{
if ( logger.isTraceEnabled() ){
logger.trace("start authentication for user {}", username);
}
AuthenticationResult ar = authenticator.authenticate(request, response,
username, password);
if ( logger.isTraceEnabled() ){
logger.trace("authentication ends with {}", ar);
}
if ((ar != null) && (ar.getState() == AuthenticationState.SUCCESS))
{
authenticate(request, password, ar);

View File

@@ -130,6 +130,12 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
if (ar == null)
{
if (logger.isTraceEnabled())
{
logger.trace("no authentication result for user {} found in cache",
username);
}
ar = doAuthentication(request, response, username, password);
if ((ar != null) && ar.isCacheable())
@@ -157,6 +163,11 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
{
for (AuthenticationHandler authenticator : authenticationHandlerSet)
{
if (logger.isTraceEnabled())
{
logger.trace("close authenticator {}", authenticator.getClass());
}
IOUtil.close(authenticator);
}
}
@@ -172,6 +183,11 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
{
for (AuthenticationHandler authenticator : authenticationHandlerSet)
{
if (logger.isTraceEnabled())
{
logger.trace("initialize authenticator {}", authenticator.getClass());
}
authenticator.init(context);
}
@@ -200,8 +216,19 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
{
AuthenticationResult ar = null;
if (logger.isTraceEnabled())
{
logger.trace("start authentication chain for user {}", username);
}
for (AuthenticationHandler authenticator : authenticationHandlerSet)
{
if (logger.isTraceEnabled())
{
logger.trace("check authenticator {} for user {}",
authenticator.getClass(), username);
}
try
{
AuthenticationResult result = authenticator.authenticate(request,