use of de.catma.repository.git.managers.GitlabManagerPrivileged in project catma by forTEXT.
the class LocalUserLoginService method loggedInFromThirdParty.
@Override
public IRemoteGitManagerRestricted loggedInFromThirdParty(String identifier, String provider, String email, String name) throws IOException {
IRemoteGitManagerPrivileged gitlabManagerPrivileged = new GitlabManagerPrivileged();
Pair<GitUser, String> userAndToken = gitlabManagerPrivileged.acquireImpersonationToken(identifier, provider, email, name);
api = iRemoteGitManagerFactory.createFromImpersonationToken(userAndToken.getSecond());
return api;
}
use of de.catma.repository.git.managers.GitlabManagerPrivileged in project catma by forTEXT.
the class LocalUserLoginService method login.
@Override
public IRemoteGitManagerRestricted login(String username, String password) throws IOException {
String user = System.getProperty("user.name");
Pair<GitUser, String> userTokenPair = new GitlabManagerPrivileged().acquireImpersonationToken(user, "catma", user + "@catma.de", user);
api = iRemoteGitManagerFactory.createFromImpersonationToken(userTokenPair.getSecond());
return api;
}
use of de.catma.repository.git.managers.GitlabManagerPrivileged in project catma by forTEXT.
the class Vaadin8InitializationService method newEntryPage.
@Override
public Component newEntryPage(EventBus eventBus, LoginService loginService, HazelCastService hazelcastService, SqliteService sqliteService) throws IOException {
IRemoteGitManagerRestricted api = loginService.getAPI();
if (api != null) {
GitProjectManager projectManager = new GitProjectManager(CATMAPropertyKey.GitBasedRepositoryBasePath.getValue(), api, // noop deletion handler
(projectId) -> {
}, acquireBackgroundService(), eventBus);
hazelcastService.start();
GitlabManagerPrivileged gitlabManagerPrivileged = new GitlabManagerPrivileged();
boolean termsOfUseConsentGiven = gitlabManagerPrivileged.updateLastLoginAndGetTermsOfUseConsent(api.getUser());
return new MainView(projectManager, new CatmaHeader(eventBus, loginService, gitlabManagerPrivileged), eventBus, api, loginService, termsOfUseConsentGiven, consent -> gitlabManagerPrivileged.setTermsOfUseConsentGiven(api.getUser(), consent));
} else {
return new NotLoggedInMainView(this, loginService, hazelcastService, sqliteService, eventBus);
}
}
use of de.catma.repository.git.managers.GitlabManagerPrivileged in project catma by forTEXT.
the class GitlabLoginService method loggedInFromThirdParty.
@Override
public IRemoteGitManagerRestricted loggedInFromThirdParty(String identifier, String provider, String email, String name) throws IOException {
IRemoteGitManagerPrivileged gitlabManagerPrivileged = new GitlabManagerPrivileged();
Pair<GitUser, String> userAndToken = gitlabManagerPrivileged.acquireImpersonationToken(identifier, provider, email, name);
api = iRemoteGitManagerFactory.createFromImpersonationToken(userAndToken.getSecond());
logLoginEvent("third party");
return api;
}
use of de.catma.repository.git.managers.GitlabManagerPrivileged in project catma by forTEXT.
the class GitProjectHandlerTest method setUp.
@BeforeEach
public void setUp() throws Exception {
// create a fake CATMA user which we'll use to instantiate GitlabManagerRestricted (using the corresponding impersonation token) & JGitRepoManager
Integer randomUserId = Integer.parseInt(RandomStringUtils.randomNumeric(3));
String username = String.format("testuser-%s", randomUserId);
String email = String.format("%s@catma.de", username);
String name = String.format("Test User %s", randomUserId);
gitlabManagerPrivileged = new GitlabManagerPrivileged();
String impersonationToken = gitlabManagerPrivileged.acquireImpersonationToken(username, "catma", email, name).getSecond();
EventBus mockEventBus = mock(EventBus.class);
BackgroundService mockBackgroundService = mock(BackgroundService.class);
gitlabManagerRestricted = new GitlabManagerRestricted(mockEventBus, mockBackgroundService, impersonationToken);
}
Aggregations