Class GitHubTokenCredentialsCreator

    • Field Detail


        public static final List<String> GH_PLUGIN_REQUIRED_SCOPE
        Default scope required for this plugin. - admin:repo_hook - for managing hooks (read, write and delete old ones) - repo - to see private repos - repo:status - to manipulate commit statuses
    • Constructor Detail

      • GitHubTokenCredentialsCreator

        public GitHubTokenCredentialsCreator()
    • Method Detail

      • doFillCredentialsIdItems

        public ListBoxModel doFillCredentialsIdItems​(@QueryParameter
                                                     String apiUrl,
                                                     String credentialsId)
      • doCreateTokenByCredentials

        public FormValidation doCreateTokenByCredentials​(@QueryParameter
                                                         String apiUrl,
                                                         String credentialsId)
      • doCreateTokenByPassword

        public FormValidation doCreateTokenByPassword​(@QueryParameter
                                                      String apiUrl,
                                                      String login,
                                                      String password)
      • createToken

        public org.kohsuke.github.GHAuthorization createToken​(@NonNull
                                                              String username,
                                                              String password,
                                                              String apiUrl)
                                                       throws IOException
        Can be used to convert given login and password to GH personal token as more secured way to interact with api
        username - gh login
        password - gh password
        apiUrl - gh api url. Can be null or empty to default
        personal token with requested scope
        IOException - when can't create token with given creds
      • createCredentials

        public com.cloudbees.plugins.credentials.common.StandardCredentials createCredentials​(@Nullable
                                                                                              String serverAPIUrl,
                                                                                              String token,
                                                                                              String username)
        Creates StringCredentials with previously created GH token. Adds them to domain extracted from server url (will be generated if no any exists before). Domain will have domain requirements consists of scheme and host from serverAPIUrl arg
        serverAPIUrl - to add to domain with host and scheme requirement from this url
        token - GH Personal token
        username - used to add to description of newly created creds
        credentials object
        See Also:
        createCredentials(String, StandardCredentials)