@Singleton public class CredentialUtils extends Object
Constructor and Description |
---|
CredentialUtils() |
Modifier and Type | Method and Description |
---|---|
hudson.util.ListBoxModel |
getAvailableCredentials(hudson.model.Item item,
String globalCredentialId,
String server)
Retrieves the UI model object containing all acceptable credentials.
|
void |
migrateGlobalCredential(HipChatNotifier.DescriptorImpl descriptor)
Migrates the credential stored in global config from the old insecure format to the Credential system.
|
void |
migrateJobCredential(HipChatNotifier.DescriptorImpl descriptor,
hudson.model.Item item,
HipChatNotifier notifier)
Migrates the credential stored in a job config from the old insecure format to the Credential system.
|
org.jenkinsci.plugins.plaincredentials.StringCredentials |
resolveCredential(hudson.model.Item context,
String credentialId,
String server)
Finds the credential with the given credentialId in the CredentialStore.
|
public org.jenkinsci.plugins.plaincredentials.StringCredentials resolveCredential(hudson.model.Item context, @CheckForNull String credentialId, String server)
context
- The context (job) to be used to find the right credential.credentialId
- The ID of the credential.server
- The URL to the HipChat server to ensure that we find the credential under the right security
domain.public hudson.util.ListBoxModel getAvailableCredentials(@CheckForNull hudson.model.Item item, String globalCredentialId, String server)
item
- The context (job) to use to find the the credentials. May be null. In job config mode, the current
value of the credential setting will be extracted from this item.globalCredentialId
- In global config mode, use this as the currently selected credential.server
- The URL to the HipChat server to ensure that we find the credentials under the right security
domain.public void migrateGlobalCredential(HipChatNotifier.DescriptorImpl descriptor) throws IOException
descriptor
- The descriptor of this plugin.IOException
- If there was an error whilst migrating the credential.public void migrateJobCredential(HipChatNotifier.DescriptorImpl descriptor, hudson.model.Item item, HipChatNotifier notifier) throws IOException
descriptor
- The descriptor of this plugin.item
- The job where the plugin is configured.notifier
- The plugin instance corresponding to this job.IOException
- If there was an error whilst migrating the credential.Copyright © 2016–2018. All rights reserved.