Class OAuthRedirectSettingsStorage
- java.lang.Object
-
- jetbrains.buildServer.serverSide.oauth.OAuthRedirectSettingsStorage
-
public class OAuthRedirectSettingsStorage extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
KEY_REDIRECT_ID_PREFIX
protected static String
STORAGE_ID
-
Constructor Summary
Constructors Constructor Description OAuthRedirectSettingsStorage(UniqueRedirectGenerator uniqueRedirectGenerator, OAuthConnectionsManager connectionsManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cleanup(SProject project, CustomDataStorage storage)
void
copyConnectionSettings(SProject sourceProject, SProject targetProject, Map<String,String> connectionIdMapping)
Copies all redirect settings of the source project to the target project.String
getOrCreateRedirectIdForConnection(SProject project, String connectionId)
Returns the stored redirect ID for the given OAuth connection.void
removeRedirectIdForConnection(SProject project, String connectionId)
Removes the stored redirect ID for a specific connection in the project.void
setRedirectIdForConnection(SProject project, String connectionId, String redirectId)
Sets the redirect ID for the given OAuth connection.
-
-
-
Field Detail
-
STORAGE_ID
protected static final String STORAGE_ID
- See Also:
- Constant Field Values
-
KEY_REDIRECT_ID_PREFIX
protected static final String KEY_REDIRECT_ID_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OAuthRedirectSettingsStorage
public OAuthRedirectSettingsStorage(@NotNull UniqueRedirectGenerator uniqueRedirectGenerator, @NotNull OAuthConnectionsManager connectionsManager)
-
-
Method Detail
-
getOrCreateRedirectIdForConnection
@NotNull public String getOrCreateRedirectIdForConnection(@NotNull SProject project, @NotNull String connectionId)
Returns the stored redirect ID for the given OAuth connection. If no redirect ID has been stored yet, a new one will be generated and persisted.- Parameters:
project
- the project that contains the connectionconnectionId
- the ID of the OAuth connection- Returns:
- the redirect ID
- Since:
- 2024.07
-
setRedirectIdForConnection
public void setRedirectIdForConnection(@NotNull SProject project, @NotNull String connectionId, @NotNull String redirectId)
Sets the redirect ID for the given OAuth connection. The redirect ID will be stored in the custom data storage of the connection's project. Any previously or concurrently persisted redirect ID will be overwritten.- Parameters:
project
- the project that contains the connectionconnectionId
- the ID of the OAuth connectionredirectId
- The redirect ID to set- Since:
- 2024.07
-
removeRedirectIdForConnection
public void removeRedirectIdForConnection(@NotNull SProject project, @NotNull String connectionId)
Removes the stored redirect ID for a specific connection in the project.- Parameters:
project
- the project that contains the connectionconnectionId
- the ID of the connection to remove the redirect ID for- Since:
- 2024.07
-
copyConnectionSettings
public void copyConnectionSettings(@NotNull SProject sourceProject, @NotNull SProject targetProject, @NotNull Map<String,String> connectionIdMapping)
Copies all redirect settings of the source project to the target project. Any settings the target project might have had will be overwritten. This could have security implications, e.g., when duplicating redirect IDs.- Parameters:
sourceProject
- the project to copy the settings fromtargetProject
- the project to copy the settings toconnectionIdMapping
- a mapping of source connection ID to target connection ID- Since:
- 2024.07
-
cleanup
protected void cleanup(@NotNull SProject project, @NotNull CustomDataStorage storage)
-
-