Class AzureDevOpsOAuthProvider
- java.lang.Object
-
- jetbrains.buildServer.serverSide.oauth.OAuthProvider
-
- jetbrains.buildServer.serverSide.oauth.azuredevops.AzureDevOpsOAuthProvider
-
- All Implemented Interfaces:
ConnectionProvider
,ServerExtension
,TeamCityExtension
public class AzureDevOpsOAuthProvider extends OAuthProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.oauth.OAuthProvider
OAuthProvider.CapabilityResolver
-
-
Field Summary
Fields Modifier and Type Field Description static String
DISPLAY_NAME
static String
ENABLE_ACQUIRING_TOKENS_FEATURE_TOGGLE
static String
TYPE
-
Fields inherited from class jetbrains.buildServer.serverSide.oauth.OAuthProvider
COMPOUND_STORAGE_ID_PREFIX, myCapabilityResolvers, NOPE
-
-
Constructor Summary
Constructors Constructor Description AzureDevOpsOAuthProvider(AzureDevOpsClient apiClient, WebLinks webLinks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
describeConnection(OAuthConnectionDescriptor connection)
String
getDisplayName()
String
getEditParametersUrl()
String
getFallbackRedirectPath()
Returns the path to be included in redirect URLs.PropertiesProcessor
getPropertiesProcessor()
String
getProviderTypeForUniqueRedirect()
Returns the provider type to be included in unique redirect URLs.String
getScope(OAuthConnectionDescriptor connectionDescriptor, String defaultScope)
String
getTokenPopupPath()
String
getTokenStorageId(OAuthConnectionDescriptor connection)
Returns an id of the token storage used by connection.Set<String>
getTokenStorageParameters()
Returns the parameters used when constructing the token storage ID for connections of this provider type.Map<String,String>
getTokenUsageParamsForVcsRoot(OAuthConnectionDescriptor connection, OAuthToken token)
Returns the necessary parameters for usage of the provided token for authentication in aSVcsRoot
.String
getType()
boolean
isAcquiringTokenSupported()
Whether acquiring tokens is supported for this provider.boolean
isTokenRefreshSupported()
boolean
isUniqueRedirectsSupported()
Whether this provider supports the creation of unique redirect URLs.OAuthToken
refreshToken(OAuthConnectionDescriptor connection, OAuthToken token)
-
Methods inherited from class jetbrains.buildServer.serverSide.oauth.OAuthProvider
applyAccessibleEntities, buildCompoundTokenStorageId, connectionHasCapability, connectionIsHidden, describeConnectionForUI, getAccessibleEntitiesEndpoint, getAdditionalUIConnectionDescription, getCapabilitiesUrl, getCapabilityResolver, getDefaultProperties, getScopeForIntent, getSupportedTokenIntentTypes, isAccessibleEntitiesSupported, isAcquiringTokenSupportedForConnection, isAvailable, isCapabilitiesEnabledForProject, isCapabilitiesSupported, isSuitableToken, registerCapabilityResolver, testConnection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.connections.ConnectionProvider
describeConnection, getDisplayOrderRank, getTypeForUrl
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
DISPLAY_NAME
public static final String DISPLAY_NAME
- See Also:
- Constant Field Values
-
ENABLE_ACQUIRING_TOKENS_FEATURE_TOGGLE
public static final String ENABLE_ACQUIRING_TOKENS_FEATURE_TOGGLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AzureDevOpsOAuthProvider
public AzureDevOpsOAuthProvider(@NotNull AzureDevOpsClient apiClient, @NotNull WebLinks webLinks)
-
-
Method Detail
-
getType
@NotNull public String getType()
- Returns:
- String used to identify the Connection Provider type. All Connection features store this property in parameters.
-
getDisplayName
@NotNull public String getDisplayName()
- Returns:
- human friendly provider name
-
describeConnection
@NotNull public String describeConnection(@NotNull OAuthConnectionDescriptor connection)
- Overrides:
describeConnection
in classOAuthProvider
- Returns:
- human friendly description of OAuth connection
-
getTokenStorageId
@NotNull public String getTokenStorageId(@NotNull OAuthConnectionDescriptor connection)
Description copied from class:OAuthProvider
Returns an id of the token storage used by connection. Depending on the connection type multiple connections can use the same token storage. In case of OAuth2 apps, this id may be based on the client/application id of the OAuth2 app configured in a third party system.- Overrides:
getTokenStorageId
in classOAuthProvider
- Parameters:
connection
- descriptor- Returns:
- token storage id
-
getPropertiesProcessor
@Nullable public PropertiesProcessor getPropertiesProcessor()
- Specified by:
getPropertiesProcessor
in interfaceConnectionProvider
- Overrides:
getPropertiesProcessor
in classOAuthProvider
- Returns:
- processor for connection provider parameters. Properties processor performs validation function and is called when connection is edited or created.
-
getEditParametersUrl
@Nullable public String getEditParametersUrl()
- Specified by:
getEditParametersUrl
in interfaceConnectionProvider
- Overrides:
getEditParametersUrl
in classOAuthProvider
- Returns:
- URL to edit connection parameters page
-
isTokenRefreshSupported
public boolean isTokenRefreshSupported()
- Overrides:
isTokenRefreshSupported
in classOAuthProvider
-
refreshToken
@NotNull public OAuthToken refreshToken(@NotNull OAuthConnectionDescriptor connection, @NotNull OAuthToken token)
- Overrides:
refreshToken
in classOAuthProvider
-
getScope
@Nullable public String getScope(@NotNull OAuthConnectionDescriptor connectionDescriptor, @Nullable String defaultScope)
- Overrides:
getScope
in classOAuthProvider
-
isAcquiringTokenSupported
public boolean isAcquiringTokenSupported()
Description copied from class:OAuthProvider
Whether acquiring tokens is supported for this provider. See also: JSP Tag oauth:obtainToken- Overrides:
isAcquiringTokenSupported
in classOAuthProvider
- Returns:
- true, if supported
-
getTokenPopupPath
public String getTokenPopupPath()
- Overrides:
getTokenPopupPath
in classOAuthProvider
-
isUniqueRedirectsSupported
public boolean isUniqueRedirectsSupported()
Description copied from class:OAuthProvider
Whether this provider supports the creation of unique redirect URLs. Providers wanting to support this feature should return true here and ensure that the respective access token controllers are registered viaBaseAccessTokenController.registerController(WebControllerManager, String)
. Also, the two related methodsOAuthProvider.getProviderTypeForUniqueRedirect()
andOAuthProvider.getFallbackRedirectPath()
must be implemented.- Overrides:
isUniqueRedirectsSupported
in classOAuthProvider
- Returns:
- false, by default
-
getProviderTypeForUniqueRedirect
@NotNull public String getProviderTypeForUniqueRedirect()
Description copied from class:OAuthProvider
Returns the provider type to be included in unique redirect URLs.- Overrides:
getProviderTypeForUniqueRedirect
in classOAuthProvider
- Returns:
- URL-compatible provider type
- See Also:
OAuthProvider.isUniqueRedirectsSupported()
-
getFallbackRedirectPath
@Nullable public String getFallbackRedirectPath()
Description copied from class:OAuthProvider
Returns the path to be included in redirect URLs. Normally this should be the access token controller path. This will be used as a fallback if this provider does not support unique redirect URLs. This will be used as a fallback if a connection does not have a redirect ID parameter.- Overrides:
getFallbackRedirectPath
in classOAuthProvider
- Returns:
- a controller path starting with a slash
- See Also:
OAuthProvider.isUniqueRedirectsSupported()
-
getTokenUsageParamsForVcsRoot
@NotNull public Map<String,String> getTokenUsageParamsForVcsRoot(@NotNull OAuthConnectionDescriptor connection, @NotNull OAuthToken token)
Description copied from class:OAuthProvider
Returns the necessary parameters for usage of the provided token for authentication in aSVcsRoot
. By default, this provides the following values:- oauthUsername
OauthToken#getOauthLogin
- tokenType
- refreshable (if refreshable tokens are enabled)
- Overrides:
getTokenUsageParamsForVcsRoot
in classOAuthProvider
- Parameters:
connection
- the token's connectiontoken
- the token to be potentially used on a VCS root- Returns:
- mutable map of parameters
-
getTokenStorageParameters
@NotNull public Set<String> getTokenStorageParameters()
Description copied from class:OAuthProvider
Returns the parameters used when constructing the token storage ID for connections of this provider type. Implementors must make sure this corresponds with the implementation ofOAuthProvider.getTokenStorageId(OAuthConnectionDescriptor)
.- Overrides:
getTokenStorageParameters
in classOAuthProvider
- Returns:
- set of parameter names
- See Also:
OAuthProvider.getTokenStorageId(OAuthConnectionDescriptor)
-
-