Closed gxgl closed 4 months ago
I have not gone through the list of parameters - it is really error prone. With that much parameters, a builder pattern would be preferable but I have never thought it would be a valid use case.
You can use the trimmed down version of the constructor and use the various setters for the other parameters..
Going through the parameters, you are missing one. Which one is left as an exercise to the reader.
Jenkins and plugins versions report
Environment
```text Jenkins: 2.452.1 OS: Linux - 3.10.0-1160.119.1.el7.x86_64 Java: 17.0.11 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- oic-auth:4.284.v0cc21de03d37 ```What Operating System are you using (both controller, and any agents involved in the problem)?
Hello,
I am trying to setup a groovy script for Jenkins to automate this and I get the following error:
I have these in my script: `import jenkins. import jenkins.model. import hudson.security. import hudson.util. import org.jenkinsci.plugins.oic.*
def j = Jenkins.get() def env = System.getenv()
// Construct the WELL_KNOWN_OPENID_CONFIGURATION_URL String baseUrl = env.JENKINS_BASE_URL ?: 'https://localhost:8080/jenkins/' def WELL_KNOWN_OPENID_CONFIGURATION_URL = baseUrl.replace('jenkins/', '') + 'auth/realms/doaas/.well-known/openid-configuration'`
// oid-auth configuration String clientId = env.OIDC_CLIENT_ID ?: '' String clientSecret = env.OIDC_CLIENT_SECRET ?: '' String wellKnownOpenIDConfigurationUrl = WELL_KNOWN_OPENID_CONFIGURATION_URL ?: '' String tokenServerUrl = env.OIDC_TOKEN_SERVER_URL ?: '' String tokenAuthMethod = 'client_secret_post' String authorizationServerUrl = env.OIDC_AUTHORIZATION_SERVER_URL ?: '' String userInfoServerUrl = env.OIDC_INFO_SERVER_URL ?: '' String userNameField = 'preferred_username' String tokenFieldToCheckKey = '' String tokenFieldToCheckValue = '' String fullNameFieldName = 'fullname' String emailFieldName = 'email' String scopes = 'openid email' String groupsFieldName = '' boolean disableSslVerification = 'false' boolean logoutFromOpenidProvider = 'true' String endSessionEndpoint = env.OIDC_END_SESSION_URL ?: '' String postLogoutRedirectUrl = env.OIDC_POST_LOGOUT_REDIRECT_URL ?: '' boolean escapeHatchEnabled = 'false' String escapeHatchUsername = '' String escapeHatchSecret = '' String escapeHatchGroup = '' String automanualconfigure = ''
....
println "Configuring OIDC security realm" oidcrealm = new OicSecurityRealm( clientId, clientSecret, wellKnownOpenIDConfigurationUrl, tokenServerUrl, tokenAuthMethod, authorizationServerUrl, userInfoServerUrl, userNameField, tokenFieldToCheckKey, tokenFieldToCheckValue, fullNameFieldName, emailFieldName, scopes, groupsFieldName, disableSslVerification, logoutFromOpenidProvider, endSessionEndpoint, postLogoutRedirectUrl, escapeHatchEnabled, escapeHatchUsername, escapeHatchSecret, escapeHatchGroup, automanualconfigure ) j.setSecurityRealm(oidcrealm) println "Configured OIDC security realm" println "Security realm configured"
Configuring OIDC security realm groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.jenkinsci.plugins.oic.OicSecurityRealm(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.String, java.lang.String, java.lang.String, java.lang.String) at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1742) at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1549) at org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite.callConstructor(MetaClassConstructorSite.java:48) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238) at Script1.run(Script1.groovy:68) ..........
What can be possibly wrong here?
Reproduction steps
Expected Results
Script to be executed without Warnings or Errors
Actual Results
Script could not be executed due to the described Warning message.
Anything else?
No response
Are you interested in contributing a fix?
Sure