Jenkins API Token

Jenkins REST API提供了API token,使得可以在程序中使用API token进行认证(而不是使用你真实的密码)。

API token可以在用户个人设置界面查看

到用户→用户id→设置页面,在API Token区域点击Show API token按钮,便可查看API token,同时还可以更改API token

相应的URL是http://<JENKINS_URL>/user/<userid>/configure

在python-jenkinsapi中使用API token,demo如下:

from jenkinsapi.jenkins import Jenkins
def get_server_instance():
    jenkins_url = ‘http://<username>:<api-token>@<jenkins-server>/‘
    server = Jenkins(jenkins_url)
    return server

if __name__ == ‘__main__‘:
    print get_server_instance().version

https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients

http://jenkinsapi.readthedocs.org/en/latest/using_jenkinsapi.html

http://stackoverflow.com/questions/10698419/how-can-a-jenkins-user-authentication-details-be-passed-to-a-script-which-uses

时间: 2024-07-30 10:37:46

Jenkins API Token的相关文章

错误: No API token found for service account &quot;default&quot;,

[[email protected] pods]# kubectl create -f mysql.yaml Error from server (ServerTimeout): error when creating "mysql.yaml": No API token found for service account "default", retry after the token is automatically created and added to t

postman 访问 jenkins api 接口异常及处理

问题:通过Postman访问 Jenkins api时出现访问权限问题 <html>    <head>        <meta http-equiv='refresh' content='1;url=/jenkins/login?from=%2Fjenkins%2Fapi%2Fjson'/>        <script>window.location.replace('/jenkins/login?from=%2Fjenkins%2Fapi%2Fjso

通过Jenkins API获得/检测Jenkins的Version

关于获得/检测Jenkins的Version,下面页面(Jenkins Remote access API)中有说明: https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API Detecting Jenkins version(检测Jenkins的Version) To check the version of Jenkins, load the top page (or, as of 1.483, any .../api/*

Laravel API Token 验证

记录一次Authorization 异常的插曲: api.php有如下配置: Route::middleware('auth:api')->post('/userfollowOrUnFollowCelebrity', '[email protected]'); FollowController构造函数及对应方法如下: public function __construct() { $this->middleware('auth')->except(['getFollowersData',

asp.net core web api token验证和RestSharp访问

对与asp.net core web api验证,多种方式,本例子的方式采用的是李争的<微软开源跨平台移动开发实践>中的token验证方式. Asp.net core web api项目代码: 首先定义三个Token相关的类,一个Token实体类,一个TokenProvider类,一个TokenProviderOptions类 代码如下: /// <summary> /// Token实体 /// </summary> public class TokenEntity

curl调用Jenkins API控制job

1.curlcurl是利用URL语法在命令行方式下工作的开源文件传输工具.它被广泛应用在Unix.多种Linux发行版中,并且有DOS和Win32.Win64下的移植版本. 1.1 获取页面/资源文件curl http://www.baidu.com获取url指向的页面:如果URL指向的是文件或者图片等资源文件,资源文件可以直接下载到本地 1.2提交GET请求curl "wwww.baidu.com?wd=jenkins” 1.3提交POST请求curl -d "wd=jenkins”

API token for Github

1.如图所示:(前提是登录Github,进入Personal settings) 2,创建token 3,生成token 4. Last login: Mon Dec  5 20:24:18 on console  GlamordeMac-mini:~ glamor$ cd /Applications/MAMP/htdocs GlamordeMac-mini:htdocs glamor$ composer create-project --prefer-dist yiisoft/yii2-app

web api token验证理解

最近一直在学习web api authentication,以Jwt为例,可以这样理解,token是身份证,用户名和密码是户口本,身份证是有有效期的(jwt 有过期时间),且携带方便(自己带有所有信息 self contained),户口本不会过期(用户名和密码什么时候都有用),携带不方便(用户名和密码从数据库验证),jwt同样也有身份证的缺点,丢了别人有些地方可以用,户口本改名字了,身份证还可以用(同样,用户名和密码修改后jwt不修改).针对身份证的缺点,可以设置较短过期时间,另外token

redis jwt spring boot spring security 实现api token 验证

文章地址:http://www.haha174.top/article/details/258083 项目源码:https://github.com/haha174/jwt-token.git 具体的实际效果可以看考这里 目前已经部署一个 个人测试机器上面: http://cloud.codeguoj.cn/api-cloud-server/swagger-ui.html#!/token45controller/loginUsingPOST 相信很多人都调用过api, 一般的大致基本步骤都是先用