Search in sources :

Example 1 with IUserManager

use of com.gitblit.manager.IUserManager in project gitblit by gitblit.

the class RedisTicketServiceTest method getService.

@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    RedisTicketService service = (RedisTicketService) new RedisTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) RedisTicketService(com.gitblit.tickets.RedisTicketService) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 2 with IUserManager

use of com.gitblit.manager.IUserManager in project gitblit by gitblit.

the class UITicketTest method getService.

protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(repo);
    }
    return service;
}
Also used : BranchTicketService(com.gitblit.tickets.BranchTicketService) INotificationManager(com.gitblit.manager.INotificationManager) NotificationManager(com.gitblit.manager.NotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 3 with IUserManager

use of com.gitblit.manager.IUserManager in project gitblit by gitblit.

the class BranchTicketServiceTest method getService.

@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    BranchTicketService service = (BranchTicketService) new BranchTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : BranchTicketService(com.gitblit.tickets.BranchTicketService) NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Example 4 with IUserManager

use of com.gitblit.manager.IUserManager in project gitblit by gitblit.

the class SshKerberosAuthenticationTest method testUserManager.

@Test
public void testUserManager() {
    IRuntimeManager rm = Mockito.mock(IRuntimeManager.class);
    // Build an UserManager that can build a UserModel
    IUserManager im = Mockito.mock(IUserManager.class);
    Mockito.doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            String user = (String) args[0];
            return new UserModel(user);
        }
    }).when(im).getUserModel(Mockito.anyString());
    AuthenticationManager am = new AuthenticationManager(rm, im);
    GSSAuthenticator gssAuthenticator = new SshKrbAuthenticator(new MemorySettings(), am);
    ServerSession session = Mockito.mock(ServerSession.class);
    // Build an SshDaemonClient that can set and get the UserModel
    final UserModelWrapper umw = new UserModelWrapper();
    SshDaemonClient client = Mockito.mock(SshDaemonClient.class);
    Mockito.when(client.getUser()).thenReturn(umw.um);
    Mockito.doAnswer(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocation) {
            Object[] args = invocation.getArguments();
            UserModel um = (UserModel) args[0];
            umw.um = um;
            return null;
        }
    }).when(client).setUser(Mockito.any(UserModel.class));
    Mockito.when(session.getAttribute(SshDaemonClient.KEY)).thenReturn(client);
    Assert.assertTrue(gssAuthenticator.validateIdentity(session, "jhappy"));
}
Also used : GSSAuthenticator(org.apache.sshd.server.auth.gss.GSSAuthenticator) ServerSession(org.apache.sshd.server.session.ServerSession) IUserManager(com.gitblit.manager.IUserManager) SshDaemonClient(com.gitblit.transport.ssh.SshDaemonClient) SshKrbAuthenticator(com.gitblit.transport.ssh.SshKrbAuthenticator) IRuntimeManager(com.gitblit.manager.IRuntimeManager) UserModel(com.gitblit.models.UserModel) AuthenticationManager(com.gitblit.manager.AuthenticationManager) InvocationOnMock(org.mockito.invocation.InvocationOnMock) MemorySettings(com.gitblit.tests.mock.MemorySettings) Test(org.junit.Test)

Example 5 with IUserManager

use of com.gitblit.manager.IUserManager in project gitblit by gitblit.

the class FileTicketServiceTest method getService.

@Override
protected ITicketService getService(boolean deleteAll) throws Exception {
    IStoredSettings settings = getSettings(deleteAll);
    XssFilter xssFilter = new AllowXssFilter();
    IRuntimeManager runtimeManager = new RuntimeManager(settings, xssFilter).start();
    IPluginManager pluginManager = new PluginManager(runtimeManager).start();
    INotificationManager notificationManager = new NotificationManager(settings).start();
    IUserManager userManager = new UserManager(runtimeManager, pluginManager).start();
    IRepositoryManager repositoryManager = new RepositoryManager(runtimeManager, pluginManager, userManager).start();
    FileTicketService service = (FileTicketService) new FileTicketService(runtimeManager, pluginManager, notificationManager, userManager, repositoryManager).start();
    if (deleteAll) {
        service.deleteAll(getRepository());
    }
    return service;
}
Also used : NotificationManager(com.gitblit.manager.NotificationManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) IStoredSettings(com.gitblit.IStoredSettings) IRuntimeManager(com.gitblit.manager.IRuntimeManager) RuntimeManager(com.gitblit.manager.RuntimeManager) IRepositoryManager(com.gitblit.manager.IRepositoryManager) IRuntimeManager(com.gitblit.manager.IRuntimeManager) IPluginManager(com.gitblit.manager.IPluginManager) PluginManager(com.gitblit.manager.PluginManager) INotificationManager(com.gitblit.manager.INotificationManager) IUserManager(com.gitblit.manager.IUserManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) FileTicketService(com.gitblit.tickets.FileTicketService) IPluginManager(com.gitblit.manager.IPluginManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) IRepositoryManager(com.gitblit.manager.IRepositoryManager) RepositoryManager(com.gitblit.manager.RepositoryManager)

Aggregations

IRuntimeManager (com.gitblit.manager.IRuntimeManager)5 IUserManager (com.gitblit.manager.IUserManager)5 IStoredSettings (com.gitblit.IStoredSettings)4 INotificationManager (com.gitblit.manager.INotificationManager)4 IPluginManager (com.gitblit.manager.IPluginManager)4 IRepositoryManager (com.gitblit.manager.IRepositoryManager)4 NotificationManager (com.gitblit.manager.NotificationManager)4 PluginManager (com.gitblit.manager.PluginManager)4 RepositoryManager (com.gitblit.manager.RepositoryManager)4 RuntimeManager (com.gitblit.manager.RuntimeManager)4 UserManager (com.gitblit.manager.UserManager)4 XssFilter (com.gitblit.utils.XssFilter)4 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)4 BranchTicketService (com.gitblit.tickets.BranchTicketService)2 AuthenticationManager (com.gitblit.manager.AuthenticationManager)1 UserModel (com.gitblit.models.UserModel)1 MemorySettings (com.gitblit.tests.mock.MemorySettings)1 FileTicketService (com.gitblit.tickets.FileTicketService)1 RedisTicketService (com.gitblit.tickets.RedisTicketService)1 SshDaemonClient (com.gitblit.transport.ssh.SshDaemonClient)1