-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHCLOUD-34913 - Refactor inventory-client-java to use common-client-j…
…ava code (#4) * Add common client dependency * Updatewd CDIManagedClients to CDIManagedInventoryClients * Make CDIManagedClients client specific * Removed common client code * Removed common client code, Added common client library calls * Removed test data * Updated CDIManagedInventoryClientsTest.java * Add inheritence to client code * Remove unused imports/Use KesselClient import
- Loading branch information
1 parent
767cfdb
commit ba1591c
Showing
24 changed files
with
100 additions
and
1,381 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
36 changes: 36 additions & 0 deletions
36
src/main/java/org/project_kessel/inventory/client/AuthnConfigConverter.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 org.project_kessel.inventory.client; | ||
|
||
import org.project_kessel.clients.authn.AuthenticationConfig; | ||
import org.project_kessel.clients.authn.oidc.client.OIDCClientCredentialsAuthenticationConfig; | ||
import org.project_kessel.clients.authn.oidc.client.OIDCClientCredentialsAuthenticationConfig.OIDCClientCredentialsConfig; | ||
|
||
public class AuthnConfigConverter { | ||
|
||
public static AuthenticationConfig convert(Config.AuthenticationConfig authnConfig) { | ||
if(authnConfig == null) { | ||
return null; | ||
} | ||
AuthenticationConfig convertedAuthnConfig; | ||
if(authnConfig.clientCredentialsConfig().isPresent()) { | ||
Config.OIDCClientCredentialsConfig oidcClientCredentialsConfig = authnConfig.clientCredentialsConfig().get(); | ||
|
||
convertedAuthnConfig = new OIDCClientCredentialsAuthenticationConfig(); | ||
var convertedOidcClientCredentialsConfig = new OIDCClientCredentialsConfig(); | ||
convertedOidcClientCredentialsConfig.setIssuer(oidcClientCredentialsConfig.issuer()); | ||
convertedOidcClientCredentialsConfig.setClientId(oidcClientCredentialsConfig.clientId()); | ||
convertedOidcClientCredentialsConfig.setClientSecret(oidcClientCredentialsConfig.clientSecret()); | ||
convertedOidcClientCredentialsConfig.setScope(oidcClientCredentialsConfig.scope()); | ||
convertedOidcClientCredentialsConfig.setOidcClientCredentialsMinterImplementation(oidcClientCredentialsConfig.oidcClientCredentialsMinterImplementation()); | ||
|
||
((OIDCClientCredentialsAuthenticationConfig)convertedAuthnConfig).setCredentialsConfig(convertedOidcClientCredentialsConfig); | ||
} else { | ||
convertedAuthnConfig = new AuthenticationConfig(); | ||
} | ||
|
||
convertedAuthnConfig.setMode(authnConfig.mode()); | ||
|
||
return convertedAuthnConfig; | ||
} | ||
} | ||
|
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
119 changes: 19 additions & 100 deletions
119
src/main/java/org/project_kessel/inventory/client/InventoryGrpcClientsManager.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
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
39 changes: 0 additions & 39 deletions
39
src/main/java/org/project_kessel/inventory/client/authn/CallCredentialsFactory.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.