|
20 | 20 | import org.eclipse.jnosql.communication.Configurations; |
21 | 21 | import org.eclipse.jnosql.communication.Settings; |
22 | 22 |
|
| 23 | +import java.io.File; |
23 | 24 | import java.io.IOException; |
24 | 25 | import java.util.List; |
25 | 26 | import java.util.Optional; |
@@ -69,14 +70,40 @@ public Optional<AuthorizationProvider> apply(Settings settings) { |
69 | 70 | if(user != null && password.length > 0 && tenantId != null && fingerprint != null && privateKey != null) { |
70 | 71 | return Optional.of(new SignatureProvider(tenantId, user, fingerprint, privateKey, password)); |
71 | 72 | } |
72 | | - |
73 | 73 | try { |
74 | 74 | return Optional.of(new SignatureProvider()); |
75 | 75 | } catch (IOException e) { |
76 | 76 | throw new OracleNoSQLException("Error to load configuration to Oracle Cloud at Oracle NoSQL", e); |
77 | 77 | } |
78 | 78 |
|
79 | 79 | } |
| 80 | + }, |
| 81 | + /** |
| 82 | + * Represents a "Cloud" deployment using resource principal for authentication and authorization. |
| 83 | + */ |
| 84 | + CLOUD_INSTANCE_PRINCIPAL { |
| 85 | + @Override |
| 86 | + public Optional<AuthorizationProvider> apply(Settings settings) { |
| 87 | + return Optional.of(SignatureProvider.createWithInstancePrincipal()); |
| 88 | + } |
| 89 | + }, |
| 90 | + /** |
| 91 | + * Represents a "Cloud" deployment using resource principal for authentication and authorization. |
| 92 | + */ |
| 93 | + CLOUD_RESOURCE_PRINCIPAL { |
| 94 | + @Override |
| 95 | + public Optional<AuthorizationProvider> apply(Settings settings) { |
| 96 | + return Optional.of(SignatureProvider.createWithResourcePrincipal()); |
| 97 | + } |
| 98 | + }, |
| 99 | + /** |
| 100 | + * Represents a "Cloud" deployment using instance principal for delegation with an OBO token. |
| 101 | + */ |
| 102 | + CLOUD_INSTANCE_OBO_USER { |
| 103 | + @Override |
| 104 | + public Optional<AuthorizationProvider> apply(Settings settings) { |
| 105 | + return Optional.of(SignatureProvider.createWithInstancePrincipalForDelegation(new File(System.getenv("OCI_obo_token_path")))); |
| 106 | + } |
80 | 107 | }; |
81 | 108 |
|
82 | 109 |
|
|
0 commit comments