@@ -35,17 +35,15 @@ public class HttpClient {
3535 private static final LoggingFacade LOGGER = LoggingFactory .getLogger ("Operator" , "Operator" );
3636
3737 private Client httpClient ;
38- private String principal ;
3938 private String encodedCredentials ;
4039
4140 private static final String HTTP_PROTOCOL = "http://" ;
4241
4342 // for debugging
4443 private static final String SERVICE_URL = System .getProperty ("oracle.kubernetes.operator.http.HttpClient.SERVICE_URL" );
4544
46- private HttpClient (Client httpClient , String principal , String encodedCredentials ) {
45+ private HttpClient (Client httpClient , String encodedCredentials ) {
4746 this .httpClient = httpClient ;
48- this .principal = principal ;
4947 this .encodedCredentials = encodedCredentials ;
5048 }
5149
@@ -144,14 +142,13 @@ public Result executePostUrlOnServiceClusterIP(String requestUrl, String service
144142
145143 /**
146144 * Asynchronous {@link Step} for creating an authenticated HTTP client targeted at a server instance
147- * @param principal Principal
148145 * @param namespace Namespace
149146 * @param adminSecretName Admin secret name
150147 * @param next Next processing step
151148 * @return step to create client
152149 */
153- public static Step createAuthenticatedClientForServer (String principal , String namespace , String adminSecretName , Step next ) {
154- return new AuthenticatedClientForServerStep (namespace , adminSecretName , new WithSecretDataStep (principal , next ));
150+ public static Step createAuthenticatedClientForServer (String namespace , String adminSecretName , Step next ) {
151+ return new AuthenticatedClientForServerStep (namespace , adminSecretName , new WithSecretDataStep (next ));
155152 }
156153
157154 private static class AuthenticatedClientForServerStep extends Step {
@@ -172,11 +169,9 @@ public NextAction apply(Packet packet) {
172169 }
173170
174171 private static class WithSecretDataStep extends Step {
175- private final String principal ;
176172
177- public WithSecretDataStep (String principal , Step next ) {
173+ public WithSecretDataStep (Step next ) {
178174 super (next );
179- this .principal = principal ;
180175 }
181176
182177 @ Override
@@ -189,7 +184,7 @@ public NextAction apply(Packet packet) {
189184 username = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_USERNAME );
190185 password = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_PASSWORD );
191186 }
192- packet .put (KEY , createAuthenticatedClient (principal , username , password ));
187+ packet .put (KEY , createAuthenticatedClient (username , password ));
193188
194189 Arrays .fill (username , (byte ) 0 );
195190 Arrays .fill (password , (byte ) 0 );
@@ -199,12 +194,11 @@ public NextAction apply(Packet packet) {
199194
200195 /**
201196 * Create authenticated client specifically targeted at an admin server
202- * @param principal Principal
203197 * @param namespace Namespace
204198 * @param adminSecretName Admin secret name
205199 * @return authenticated client
206200 */
207- public static HttpClient createAuthenticatedClientForServer (String principal , String namespace , String adminSecretName ) {
201+ public static HttpClient createAuthenticatedClientForServer (String namespace , String adminSecretName ) {
208202 SecretHelper secretHelper = new SecretHelper (namespace );
209203 Map <String , byte []> secretData =
210204 secretHelper .getSecretData (SecretHelper .SecretType .AdminCredentials , adminSecretName );
@@ -215,18 +209,16 @@ public static HttpClient createAuthenticatedClientForServer(String principal, St
215209 username = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_USERNAME );
216210 password = secretData .get (SecretHelper .ADMIN_SERVER_CREDENTIALS_PASSWORD );
217211 }
218- return createAuthenticatedClient (principal , username , password );
212+ return createAuthenticatedClient (username , password );
219213 }
220214
221215 /**
222216 * Create authenticated HTTP client
223- * @param principal Principal
224217 * @param username Username
225218 * @param password Password
226219 * @return authenticated client
227220 */
228- public static HttpClient createAuthenticatedClient (String principal ,
229- final byte [] username ,
221+ public static HttpClient createAuthenticatedClient (final byte [] username ,
230222 final byte [] password ) {
231223 // build client with authentication information.
232224 Client client = ClientBuilder .newClient ();
@@ -238,18 +230,17 @@ public static HttpClient createAuthenticatedClient(String principal,
238230 System .arraycopy (password , 0 , usernameAndPassword , username .length + 1 , password .length );
239231 encodedCredentials = java .util .Base64 .getEncoder ().encodeToString (usernameAndPassword );
240232 }
241- return new HttpClient (client , principal , encodedCredentials );
233+ return new HttpClient (client , encodedCredentials );
242234 }
243235
244236 /**
245237 * Returns the URL to access the service; using the service clusterIP and port.
246238 *
247- * @param principal The principal that will be used to call the Kubernetes API.
248239 * @param name The name of the Service that you want the URL for.
249240 * @param namespace The Namespace in which the Service you want the URL for is defined.
250- * @return The URL of the Service, or null if it is not found or principal does not have sufficient permissions.
241+ * @return The URL of the Service, or null if it is not found
251242 */
252- public static String getServiceURL (String principal , String name , String namespace ) {
243+ public static String getServiceURL (String name , String namespace ) {
253244 try {
254245 CallBuilderFactory factory = ContainerResolver .getInstance ().getContainer ().getSPI (CallBuilderFactory .class );
255246 return getServiceURL (factory .create ().readService (name , namespace ));
0 commit comments