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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          raihaan Raihaan Shouhell added a comment -

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

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

          Raihaan ShouhellI I updated the description

          Show
          nashwan Nashwan added a comment - Raihaan Shouhell I I updated the description
          Show
          raihaan 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
          Hide
          nashwan Nashwan added a comment -

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

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

            People

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

              Dates

              Created:
              Updated:
              Resolved: