jenkinsci / jenkinsci/credentials-plugin

[JENKINS-60766] Credential icon names should be extracted as string constants

Open
#850 1 comment 0 reactions 0 assignees View on GitHub
component:credentials-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
134
Forks
258
Avg merge
48m
Merged PRs (30d)
1

Description

I would like my credential provider's implementations of the standard credential types to use the same icons as the built-in disk credentials provider, since this follows user expectations. (Indeed a user of my provider has filed a bug because they differ.)

But although the credential icons seem to be provided centrally, the icon class name strings are not available centrally (as static constants). Instead they are returned inline in the disk credentials provider descriptors. For example:

public class UsernamePasswordCredentialsImpl 

extends BaseStandardCredentials
implements StandardUsernamePasswordCredentials {

// ...

@​Extension(ordinal = 1)
public static class DescriptorImpl extends BaseStandardCredentialsDescriptor {

@​Override
public String getIconClassName() {
// We can't access this from downstream providers
return "icon-credentials-userpass";
}
}


This means the only way to use those strings in downstream credential providers is to copy and paste them. Icon rendering will break if the name strings change in future.

Solution: The icon class names should be available as public static string constants somewhere in the credentials plugin.

---
Originally reported by chriskilding, imported from: Credential icon names should be extracted as string constants


  • status: Open
  • priority: Minor
  • component(s): credentials-plugin
  • label(s): extension
  • resolution: Unresolved
  • votes: 2
  • watchers: 3
  • imported: 2025-12-08

Raw content of original issue

I would like my credential provider's implementations of the standard credential types to use the same icons as the built-in disk credentials provider, since this follows user expectations. (Indeed a user of my provider has filed a bug because they differ.)

But although the credential icons seem to be provided centrally, the icon class name strings are not available centrally (as static constants). Instead they are returned inline in the disk credentials provider descriptors. For example:



public class UsernamePasswordCredentialsImpl 

extends BaseStandardCredentials
implements StandardUsernamePasswordCredentials {

// ...

@Extension(ordinal = 1)
public static class DescriptorImpl extends BaseStandardCredentialsDescriptor {

@Override
public String getIconClassName() {
// We can't access this from downstream providers
return "icon-credentials-userpass";
}
}



This means the only way to use those strings in downstream credential providers is to copy and paste them. Icon rendering will break if the name strings change in future.

Solution: The icon class names should be available as public static string constants somewhere in the credentials plugin.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.