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

          Nashwan created issue -
          Nashwan made changes -
          Labels Original: 2.263.1-lts jenkins New: 2.263.1-lts jenkins security
          Nashwan made changes -
          Summary Original: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue New: 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 made changes -
          Description Original: The class `jenkins.security.apitoken.ApiTokenStore.TokenUuidAndPlainValue` can no longer be loaded.

          Exception message: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue 
          New: 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

           
          {code:java}
          import jenkins.security.apitoken.ApiTokenStore
          import jenkins.security.ApiTokenProperty

          Thread.start {
              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);
          }
          {code}
          An Exception with the  message: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue is thrown when this script is executed

          Nashwan added a comment -

          raihaanI I updated the description

          Nashwan added a comment - raihaan I I updated the description
          Nashwan made changes -
          Description Original: 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

           
          {code:java}
          import jenkins.security.apitoken.ApiTokenStore
          import jenkins.security.ApiTokenProperty

          Thread.start {
              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);
          }
          {code}
          An Exception with the  message: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue is thrown when this script is executed
          New: 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

           
          {code:java}
          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);
          }
          {code}
          An Exception with the  message: unable to resolve class ApiTokenStore.TokenUuidAndPlainValue is thrown when this script is executed

          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
          Tim Jacomb made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Tim Jacomb made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]

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

              Created:
              Updated:
              Resolved: