-
Bug
-
Resolution: Not A Defect
-
Major
-
Jenkins LTS 2.263.1
The class `jenkins.security.apitoken.ApiTokenStore.TokenUuidAndPlainValue` can no longer be loaded.
This issue appears when trying to use this class in a start up groovy script under "/usr/share/jenkins/ref/". The Groovy script is something like this
import jenkins.security.apitoken.ApiTokenStore import jenkins.security.ApiTokenProperty Thread.start { while (Jenkins.instance.initLevel != COMPLETED) { println('waiting for Jenkins to be fully up before provisioning API users') sleep 1000 } def username = "some user" def tokenName = 'some name' User u = User.get(username) ApiTokenProperty p = u.getProperty(ApiTokenProperty.class) if (p == null) { p = forceNewInstance(u, false); u.addProperty(p); } ApiTokenStore.TokenUuidAndPlainValue tokenUuidAndPlainValue = p.tokenStore.generateNewToken(tokenName); }
An Exception with the message: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue is thrown when this script is executed