public class TokenAuth extends Auth2
Modifier and Type | Class and Description |
---|---|
static class |
TokenAuth.TokenAuthDescriptor |
Auth2.Auth2Descriptor
Modifier and Type | Field and Description |
---|---|
static Auth2.Auth2Descriptor |
DESCRIPTOR |
Constructor and Description |
---|
TokenAuth() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Secret |
getApiToken() |
Auth2.Auth2Descriptor |
getDescriptor() |
String |
getUserName() |
int |
hashCode() |
void |
setApiToken(Secret apiToken) |
void |
setAuthorizationHeader(URLConnection connection,
BuildContext context)
Depending on the purpose the Auth2 implementation has to override the
Authorization header of the connection appropriately. |
void |
setUserName(String userName) |
String |
toString() |
String |
toString(Item item)
Returns a string representing the authorization.
|
@Extension public static final Auth2.Auth2Descriptor DESCRIPTOR
@DataBoundSetter public void setUserName(String userName)
public String getUserName()
@DataBoundSetter public void setApiToken(Secret apiToken)
public Secret getApiToken()
public void setAuthorizationHeader(URLConnection connection, BuildContext context) throws IOException
Auth2
Authorization
header of the connection appropriately. It might also ignore this
step or remove an existing Authorization
header.setAuthorizationHeader
in class Auth2
connection
- connection between the application and the remote server.context
- the context of this Builder/BuildStep.IOException
- if there is an error generating the authorization header.public String toString(Item item)
Auth2
toString
in class Auth2
item
- the Item (Job, Pipeline,...) we are currently running in.
The item is required to also get Credentials which are defined in the items scope and not Jenkins globally.
Value can be null, but Credentials e.g. configured on a Folder will not be found in this case,
only globally configured Credentials.public Auth2.Auth2Descriptor getDescriptor()
getDescriptor
in interface Describable<Auth2>
getDescriptor
in class AbstractDescribableImpl<Auth2>
Copyright © 2016–2023. All rights reserved.