Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64391

Unable to resolve class jenkins.security.apitoken.ApiTokenStore.TokenUuidAndPlainValue

      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

          [JENKINS-64391] Unable to resolve class jenkins.security.apitoken.ApiTokenStore.TokenUuidAndPlainValue

          Where do you see this and do you have any steps that can help reproduce this issue

          Raihaan Shouhell added a comment - Where do you see this and do you have any steps that can help reproduce this issue

          Nashwan added a comment -

          raihaanI I updated the description

          Nashwan added a comment - raihaan I I updated the description

          Raihaan Shouhell added a comment - TokenUuidAndPlainValue has been moved to a separate file see https://github.com/jenkinsci/jenkins/blob/jenkins-2.263.1/core/src/main/java/jenkins/security/apitoken/TokenUuidAndPlainValue.java

          Nashwan added a comment -

          That solved my problem. But I was wondering why this change was not listed in the changelog of this version

          Nashwan added a comment - That solved my problem. But I was wondering why this change was not listed in the changelog of this version

            Unassigned Unassigned
            nashwan Nashwan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: