@Extension @Symbol(value="apiToken") public static final class ApiTokenProperty.DescriptorImpl extends UserPropertyDescriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
clazz
Constructor and Description |
---|
DescriptorImpl() |
Modifier and Type | Method and Description |
---|---|
org.kohsuke.stapler.HttpResponse |
doChangeToken(User u,
org.kohsuke.stapler.StaplerResponse rsp)
Deprecated.
use
doGenerateNewToken(User, String) instead |
org.kohsuke.stapler.HttpResponse |
doGenerateNewToken(User u,
String newTokenName) |
org.kohsuke.stapler.HttpResponse |
doRename(User u,
String tokenUuid,
String newName) |
org.kohsuke.stapler.HttpResponse |
doRevoke(User u,
String tokenUuid) |
String |
getDisplayName()
Human readable name of this kind of configurable object.
|
String |
getNoLegacyToken() |
boolean |
hasCurrentUserRightToGenerateNewToken(User propertyOwner) |
boolean |
isStatisticsEnabled() |
boolean |
mustDisplayLegacyApiToken(User propertyOwner) |
ApiTokenProperty |
newInstance(User user)
New approach:
API Token are generated only when a user request a new one.
|
isEnabled
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
public String getDisplayName()
Descriptor
Class.getSimpleName()
on Descriptor.clazz
, so for example MyThing
from some.pkg.MyThing.DescriptorImpl
.
Historically some implementations returned null as a way of hiding the descriptor from the UI,
but this is generally managed by an explicit method such as isEnabled
or isApplicable
.getDisplayName
in class Descriptor<UserProperty>
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getNoLegacyToken()
public ApiTokenProperty newInstance(User user)
ApiTokenProperty
for User,
we need to make sure it yields the same value for the same user,
because there's no guarantee that the property is saved.
But we also need to make sure that an attacker won't be able to guess
the initial API token value. So we take the seed by hashing the secret + user ID.newInstance
in class UserPropertyDescriptor
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isStatisticsEnabled()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean mustDisplayLegacyApiToken(User propertyOwner)
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean hasCurrentUserRightToGenerateNewToken(User propertyOwner)
@Deprecated public org.kohsuke.stapler.HttpResponse doChangeToken(@AncestorInPath User u, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
doGenerateNewToken(User, String)
insteadIOException
public org.kohsuke.stapler.HttpResponse doGenerateNewToken(@AncestorInPath User u, @QueryParameter String newTokenName) throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doRename(@AncestorInPath User u, @QueryParameter String tokenUuid, @QueryParameter String newName) throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doRevoke(@AncestorInPath User u, @QueryParameter String tokenUuid) throws IOException
IOException
Copyright © 2004–2019. All rights reserved.