public class ApiTokenProperty extends UserProperty
ApiTokenFilter
Modifier and Type | Class and Description |
---|---|
static class |
ApiTokenProperty.DescriptorImpl |
static class |
ApiTokenProperty.TokenInfoAndStats |
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static HMACConfidentialKey |
API_KEY_SEED
Deprecated.
|
user
Constructor and Description |
---|
ApiTokenProperty() |
Modifier and Type | Method and Description |
---|---|
String |
addFixedNewToken(String name,
String tokenPlainValue) |
void |
changeApiToken()
Deprecated.
Each token can be revoked now and new tokens can be requested without altering existing ones.
|
void |
deleteApiToken()
Does not revoke the token stored in the store
|
TokenUuidAndPlainValue |
generateNewToken(String name) |
String |
getApiToken()
Gets the API token.
|
Collection<ApiTokenProperty.TokenInfoAndStats> |
getTokenList() |
ApiTokenStats |
getTokenStats() |
ApiTokenStore |
getTokenStore() |
boolean |
hasLegacyToken()
Determine if the legacy token is still present
|
boolean |
matchesPassword(String token) |
UserProperty |
reconfigure(org.kohsuke.stapler.StaplerRequest req,
net.sf.json.JSONObject form)
Allow user to rename tokens
|
void |
revokeAllTokens() |
void |
revokeAllTokensExceptOne(String tokenUuid) |
void |
revokeToken(String tokenUuid) |
protected void |
setUser(User u) |
all, getDescriptor
@Deprecated @Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final HMACConfidentialKey API_KEY_SEED
protected void setUser(User u)
setUser
in class UserProperty
@NonNull public String getApiToken()
Jenkins.ADMINISTER
may be allowed to do it using SHOW_LEGACY_TOKEN_TO_ADMINS
.Messages.ApiTokenProperty_ChangeToken_TokenIsHidden()
if the user has no appropriate permissions.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean hasLegacyToken()
public boolean matchesPassword(String token)
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public Collection<ApiTokenProperty.TokenInfoAndStats> getTokenList()
public UserProperty reconfigure(org.kohsuke.stapler.StaplerRequest req, @CheckForNull net.sf.json.JSONObject form) throws Descriptor.FormException
reconfigure
in interface ReconfigurableDescribable<UserProperty>
reconfigure
in class UserProperty
req
- The current HTTP request being processed.form
- JSON fragment that corresponds to this describable object.
If the newly submitted form doesn't include a fragment for this describable
(meaning the user has de-selected your descriptor), then this argument is null.Descriptor.FormException
@Deprecated public void changeApiToken() throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public void deleteApiToken()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public ApiTokenStore getTokenStore()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public ApiTokenStats getTokenStats()
@Restricted(value=org.kohsuke.accmod.restrictions.Beta.class) @NonNull public String addFixedNewToken(@NonNull String name, @NonNull String tokenPlainValue) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.Beta.class) @NonNull public TokenUuidAndPlainValue generateNewToken(@NonNull String name) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.Beta.class) public void revokeAllTokens() throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.Beta.class) public void revokeAllTokensExceptOne(@NonNull String tokenUuid) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.Beta.class) public void revokeToken(@NonNull String tokenUuid) throws IOException
IOException
Copyright © 2004–2021. All rights reserved.