|
|
@@ -9,6 +9,7 @@ import com.nju.edu.gitlab.service.api.UserService;
|
|
|
import com.nju.edu.gitlab.util.ApplicationProperties;
|
|
|
import com.nju.edu.gitlab.util.Tools;
|
|
|
import com.nju.edu.gitlab.vo.GitlabUserVO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.gitlab4j.api.GitLabApi;
|
|
|
import org.gitlab4j.api.GitLabApiException;
|
|
|
import org.gitlab4j.api.models.ImpersonationToken;
|
|
|
@@ -18,6 +19,7 @@ import org.gitlab4j.api.models.User;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Component
|
|
|
public class UserServiceImpl implements UserService {
|
|
|
private final GitLabApi gitlabApi;
|
|
|
@@ -128,6 +130,7 @@ public class UserServiceImpl implements UserService {
|
|
|
private String createToken(Integer userId) throws GitLabApiException {
|
|
|
Scope[] scopes = new Scope[]{Scope.API};
|
|
|
ImpersonationToken token;
|
|
|
+ log.info(String.format("createToken, userId = %d",userId));
|
|
|
token = gitlabApi.getUserApi().createImpersonationToken(userId, "AES-" + Tools.randomUUID(), null, scopes);
|
|
|
return token.getToken();
|
|
|
}
|