You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Authentication.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,25 @@ provider "cloudfoundry" {
30
30
}
31
31
```
32
32
33
+
## OAuth JWT Assertion Bearer Flow
34
+
35
+
Use the env variable `CF_ASSERTION_TOKEN`. Typically for cloudfoundry, this login also would use a custom `origin` (unless the default `origin` is configured to support this method)
36
+
37
+
Refer [this document](https://docs.secureauth.com/ciam/en/using-jwt-profile-for-oauth-2-0-authorization-flows.html) to understand the JWT Assertion Bearer Flow.
38
+
39
+
This flow can be used in automated scenarios where the OIDC provider that is trusted by UAA has a secure means of providing assertion tokens. These tokens are short lived.
40
+
41
+
A typical example would be using the the Open-ID Connect feature of [github](https://docs.github.com/en/actions/concepts/security/openid-connect)
42
+
In this scenario, an `origin` in UAA would be configured to use Github OIDC as an [identity provider](https://docs.cloudfoundry.org/uaa/identity-providers.html#oidc). Refer this [blog](https://community.sap.com/t5/technology-blog-posts-by-sap/authenticating-github-actions-workflows-deploying-to-the-sap-btp-cloud/ba-p/14075047) where a similar setup is done with the cf cli. **Similarly**, the terraform provider can then use assertion tokens provided by github in a github action to login to Cloud Foundry with that specific `origin`
43
+
44
+
```hcl
45
+
provider "cloudfoundry" {
46
+
api_url = "<CF-API-URL>"
47
+
cf_client_id = "<CF-ASSERTION-TOKEN>"
48
+
origin = "<CF-ORIGIN>"
49
+
}
50
+
```
51
+
33
52
## Using cf-cli configuration.
34
53
35
54
If you have installed the [cf-cli](https://docs.cloudfoundry.org/cf-cli/) and have [logged into the environment](https://docs.cloudfoundry.org/cf-cli/getting-started.html#login), the the cloudfoundry terraform provider can use the default configuration of the cf-cli (present in `~/.cf` folder) to connect to the environment.
MarkdownDescription: "OAuth JWT assertion token. Used for OAuth 2.0 JWT Bearer Assertion Grant flow to authenticate with Cloud Foundry. Typically used with a custom origin.",
118
+
Optional: true,
119
+
Sensitive: true,
120
+
Validators: []validator.String{
121
+
stringvalidator.LengthAtLeast(1),
122
+
},
123
+
},
115
124
},
116
125
}
117
126
}
@@ -134,7 +143,7 @@ func addTypeCastAttributeError(resp *provider.ConfigureResponse, expectedType st
// 1. If endpoint is empty and any other parameter is set
180
+
// 2. If endpoint is set and all other parameter is empty
181
+
// 3. If all parameters are empty and CF config is not correctly set
182
+
if (config.Endpoint==""&&anyParamExists) || (config.Endpoint!=""&&!anyParamExists) || (!anyParamExists&&cfconfigerr!=nil) {
171
183
resp.Diagnostics.AddError(
172
184
"Unable to create CF Client due to missing values",
173
185
"Either user/password or client_id/client_secret or access_token must be set with api_url or CF config must exist in path (default ~/.cf/config.json)",
t.Logf("\nATTENTION: Using redacted user credentials since endpoint, assertion & origin not set as env \n Make sure you are not triggering a recording else test will fail")
Copy file name to clipboardExpand all lines: docs/index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ provider "cloudfoundry" {
33
33
34
34
-`access_token` (String, Sensitive) OAuth token to authenticate with Cloud Foundry
35
35
-`api_url` (String) Specific URL representing the entry point for communication between the client and a Cloud Foundry instance.
36
+
-`assertion_token` (String, Sensitive) OAuth JWT assertion token. Used for OAuth 2.0 JWT Bearer Assertion Grant flow to authenticate with Cloud Foundry. Typically used with a custom origin.
36
37
-`cf_client_id` (String) Unique identifier for a client application used in authentication and authorization processes
37
38
-`cf_client_secret` (String, Sensitive) A confidential string used by a client application for secure authentication and authorization, requires cf_client_id to authenticate
38
39
-`origin` (String) Indicates the identity provider to be used for login
0 commit comments