File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
java-ai/src/main/java/oracleai/services Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 6
6
import com .oracle .bmc .auth .BasicAuthenticationDetailsProvider ;
7
7
import com .oracle .bmc .auth .ConfigFileAuthenticationDetailsProvider ;
8
8
import com .oracle .bmc .auth .ResourcePrincipalAuthenticationDetailsProvider ;
9
+ import com .oracle .bmc .auth .InstancePrincipalsAuthenticationDetailsProvider ;
9
10
import java .io .IOException ;
10
11
11
12
public class AuthProvider {
12
13
13
14
public static BasicAuthenticationDetailsProvider getAuthenticationDetailsProvider () throws IOException {
14
- return ResourcePrincipalAuthenticationDetailsProvider .builder ().build ();
15
+ if (isRunningInOKE ()) return InstancePrincipalsAuthenticationDetailsProvider .builder ().build ();
16
+ else return new ConfigFileAuthenticationDetailsProvider (
17
+ System .getenv ("OCICONFIG_FILE" ), System .getenv ("OCICONFIG_PROFILE" ));
15
18
}
16
19
17
20
private static boolean isRunningInOKE () {
18
21
return true ; //System.getenv("OCI_RESOURCE_PRINCIPAL_VERSION") != null;
19
22
}
20
23
21
- public static AuthenticationDetailsProvider getConfigFileAuthenticationDetailsProvider () throws IOException {
22
- return new ConfigFileAuthenticationDetailsProvider (
23
- System .getenv ("OCICONFIG_FILE" ), System .getenv ("OCICONFIG_PROFILE" ));
24
- // InstancePrincipalsAuthenticationDetailsProvider.builder().build();
25
- }
26
24
}
You can’t perform that action at this time.
0 commit comments