Search in sources :

Example 1 with RedmineAuthProvider

use of com.gitblit.auth.RedmineAuthProvider in project gitblit by gitblit.

the class RedmineAuthenticationTest method newAuthenticationManager.

AuthenticationManager newAuthenticationManager() {
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(getSettings(), xssFilter, GitBlitSuite.BASEFOLDER).start();
    UserManager users = new UserManager(runtime, null).start();
    RedmineAuthProvider redmine = new RedmineAuthProvider();
    redmine.setup(runtime, users);
    redmine.setTestingCurrentUserAsJson(JSON);
    AuthenticationManager auth = new AuthenticationManager(runtime, users);
    auth.addAuthenticationProvider(redmine);
    return auth;
}
Also used : AuthenticationManager(com.gitblit.manager.AuthenticationManager) UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) RuntimeManager(com.gitblit.manager.RuntimeManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) RedmineAuthProvider(com.gitblit.auth.RedmineAuthProvider)

Example 2 with RedmineAuthProvider

use of com.gitblit.auth.RedmineAuthProvider in project gitblit by gitblit.

the class RedmineAuthenticationTest method testAuthenticate.

@Test
public void testAuthenticate() throws Exception {
    RedmineAuthProvider redmine = newRedmineAuthentication();
    redmine.setTestingCurrentUserAsJson(JSON);
    UserModel userModel = redmine.authenticate("RedmineAdminId", "RedmineAPIKey".toCharArray());
    assertThat(userModel.getName(), is("redmineadminid"));
    assertThat(userModel.getDisplayName(), is("baz foo"));
    assertThat(userModel.emailAddress, is("baz@example.com"));
    assertNotNull(userModel.cookie);
}
Also used : UserModel(com.gitblit.models.UserModel) RedmineAuthProvider(com.gitblit.auth.RedmineAuthProvider) Test(org.junit.Test)

Example 3 with RedmineAuthProvider

use of com.gitblit.auth.RedmineAuthProvider in project gitblit by gitblit.

the class RedmineAuthenticationTest method newRedmineAuthentication.

RedmineAuthProvider newRedmineAuthentication(IStoredSettings settings) {
    XssFilter xssFilter = new AllowXssFilter();
    RuntimeManager runtime = new RuntimeManager(settings, xssFilter, GitBlitSuite.BASEFOLDER).start();
    UserManager users = new UserManager(runtime, null).start();
    RedmineAuthProvider redmine = new RedmineAuthProvider();
    redmine.setup(runtime, users);
    return redmine;
}
Also used : UserManager(com.gitblit.manager.UserManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) XssFilter(com.gitblit.utils.XssFilter) RuntimeManager(com.gitblit.manager.RuntimeManager) AllowXssFilter(com.gitblit.utils.XssFilter.AllowXssFilter) RedmineAuthProvider(com.gitblit.auth.RedmineAuthProvider)

Aggregations

RedmineAuthProvider (com.gitblit.auth.RedmineAuthProvider)3 RuntimeManager (com.gitblit.manager.RuntimeManager)2 UserManager (com.gitblit.manager.UserManager)2 XssFilter (com.gitblit.utils.XssFilter)2 AllowXssFilter (com.gitblit.utils.XssFilter.AllowXssFilter)2 AuthenticationManager (com.gitblit.manager.AuthenticationManager)1 UserModel (com.gitblit.models.UserModel)1 Test (org.junit.Test)1