簡體   English   中英

使用jenkins中的openid connect插件自動將Jenkins與Azure AD集成

[英]Automate integration Jenkins with Azure AD using openid connect plugin in jenkins

我手動將jenkins與Azure AD集成在一起,並且工作正常。 但是我正在尋找某種腳本(也許是Groovy),它會自動為我執行此操作。 如果不是,是否可以通過curl / wget post方法使用Web API?

在此處輸入圖片說明

我正在嘗試使用此腳本

import hudson.model.*
import jenkins.model.*
import hudson.tools.*
import hudson.security.*
import hudson.plugins.*
import hudson.security.SecurityRealm.*


def instance = Jenkins.getInstance()
String clientId = 'xxxx'
String clientSecret = 'xxxxxx'
String tokenServerUrl = 'https//login.xxxxxx'
String authorizationServerUrl = 'https//login.xxxxxxx'
String userInfoServerUrl = ''
String userNameField = 'sub'
String tokenFieldToCheckKey = ''
String tokenFieldToCheckValue = ''
String fullNameFieldName = 'name'
String emailFieldName = 'email'
String scopes = 'openid email profile'
String groupsFieldName = ''
boolean disableSslVerification = 'false'
boolean logoutFromOpenidProvider = 'false'
String endSessionUrl = ''
String postLogoutRedirectUrl = ''
boolean escapeHatchEnabled = 'false'
String escapeHatchUsername = ''
String escapeHatchSecret = ''
String escapeHatchGroup = ''


adrealm = new OicSecurityRealm(clientId, clientSecret, tokenServerUrl, authorizationServerUrl, userInfoServerUrl, userNameField, tokenFieldToCheckKey, tokenFieldToCheckValue, fullNameFieldName, emailFieldName, scopes, groupsFieldName, disableSslVerification, logoutFromOpenidProvider, endSessionUrl, postLogoutRedirectUrl, escapeHatchEnabled, escapeHatchUsername, escapeHatchSecret, escapeHatchGroup)

instance.setSecurityRealm(adrealm)

這是我得到的錯誤。

運行結果
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 28: unable to resolve class OicSecurityRealm @ line 28, column 11. adrealm = new OicSecurityRealm(clientId, clientSecret, tokenServerUrl, authorizationServerUrl, userInfoServerUrl, userNameField, tokenFieldToCheckKey, tokenFieldToCheckValue, fullNameFieldName, emailFieldName, scopes, groupsFieldName, disableSslVerification, logoutFromOpenidProvider, endSessionUrl, postLogoutRedirectUrl, escapeHatchEnabled, escapeHatchUsername, escapeHatchSecret, escapeHatchGroup) ^

我通過添加這一行使其工作。 import org.jenkinsci.plugins.oic.*

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM