Commit 35e83d8e authored by Philippe Vienne's avatar Philippe Vienne Committed by Greg Messner
Browse files

Corrected scopes for impersonation tokens (#374) (#375)

parent 18ff06d5
......@@ -14,7 +14,7 @@ public class ImpersonationToken {
/** Enum to specify the scope of an ImpersonationToken. */
public enum Scope {
API, READ_USER;
API, READ_USER, READ_REPOSITORY, WRITE_REPOSITORY, READ_REGISTRY, SUDO;
private static JacksonJsonEnumHelper<Scope> enumHelper = new JacksonJsonEnumHelper<>(Scope.class);
......
......@@ -214,13 +214,13 @@ public class TestUserApi extends AbstractIntegrationTest {
public void testCreateImpersonationToken() throws GitLabApiException, ParseException {
User user = gitLabApi.getUserApi().getCurrentUser();
Scope[] scopes = {Scope.API, Scope.READ_USER};
Scope[] scopes = {Scope.API, Scope.READ_USER, Scope.READ_REGISTRY, Scope.WRITE_REPOSITORY, Scope.SUDO};
Date expiresAt = ISO8601.toDate("2018-01-01T00:00:00Z");
ImpersonationToken token = gitLabApi.getUserApi().createImpersonationToken(user.getId(), TEST_IMPERSONATION_TOKEN_NAME, expiresAt, scopes);
assertNotNull(token);
assertNotNull(token.getId());
assertEquals(TEST_IMPERSONATION_TOKEN_NAME, token.getName());
assertEquals(2, token.getScopes().size());
assertEquals(5, token.getScopes().size());
gitLabApi.getUserApi().revokeImpersonationToken(user.getId(), token.getId());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment