未验证 提交 17a723b0 编写于 作者: 小东 提交者: Gitee

!58 新增对gitlab通过令牌推送的支持

Merge pull request !58 from Heaven/master
......@@ -52,7 +52,7 @@ public class GitRepo {
}
/**
* 设置ssh秘钥或者账号密码
* 设置ssh秘钥或者账号密码或者使用OAuth2进行认证
*
* @param transportCommand
* @return
......@@ -87,6 +87,13 @@ public class GitRepo {
transportCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
properties.getUsername(),
properties.getPassword()));
} else if (StringUtils.isNotBlank(properties.getUrl()) && properties.getUrl().contains("oauth2:")) {
//采取OAuth2进行认证 面向gitlab api场景 Heaven96 @ 2022年11月30日13:27:38 开始
final String url = properties.getUrl();
int start = url.indexOf("oauth2:") + 7;
int end = url.indexOf("@");
transportCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider("oauth2",url.substring(start,end)));
//采取OAuth2进行认证 面向gitlab api场景 Heaven96 @ 2022年11月30日13:27:38 结束
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册