-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom enhanced auth support on symphony agent apis
- Loading branch information
1 parent
5e4eab3
commit 402fbbb
Showing
25 changed files
with
271 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ony-bdk-core/src/main/java/com/symphony/bdk/core/client/EnhancedAuthApiClientFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.symphony.bdk.core.client; | ||
|
||
import com.symphony.bdk.core.config.model.BdkAgentConfig; | ||
import com.symphony.bdk.core.config.model.BdkConfig; | ||
import com.symphony.bdk.core.config.model.BdkCustomEnhancedAuthConfig; | ||
import com.symphony.bdk.http.api.ApiClient; | ||
import com.symphony.bdk.http.api.auth.Authentication; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apiguardian.api.API; | ||
|
||
import jakarta.annotation.Nonnull; | ||
|
||
@Slf4j | ||
@API(status = API.Status.EXPERIMENTAL) | ||
public class EnhancedAuthApiClientFactory extends ApiClientFactory { | ||
|
||
private final Authentication enhancedAuthentication; | ||
private final BdkCustomEnhancedAuthConfig enhancedAuthConfig; | ||
|
||
public EnhancedAuthApiClientFactory(@Nonnull BdkConfig config, @Nonnull Authentication enhancedAuthentication) { | ||
super(config); | ||
this.enhancedAuthentication = enhancedAuthentication; | ||
this.enhancedAuthConfig = config.getEnhancedAuth(); | ||
} | ||
|
||
@Override | ||
protected ApiClient buildAgentClient(String basePath, BdkAgentConfig agentConfig) { | ||
return addAuthScheme(super.getApiClientBuilder(basePath, agentConfig).build()); | ||
} | ||
|
||
private ApiClient addAuthScheme(ApiClient apiClient) { | ||
apiClient.addEnforcedAuthenticationScheme(enhancedAuthConfig.getId()); | ||
apiClient.getAuthentications().put(enhancedAuthConfig.getId(), enhancedAuthentication); | ||
return apiClient; | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.