Skip to content

Commit 42f857e

Browse files
authored
add tls authentication for httpendpoint (#3780)
Signed-off-by: yaron2 <schneider.yaron@live.com>
1 parent da0ffcf commit 42f857e

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

daprdocs/content/en/developing-applications/building-blocks/service-invocation/howto-invoke-non-dapr-endpoints.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,52 @@ localhost:3500/v1.0/invoke/<appID>/method/<my-method>
7979
curl http://localhost:3602/v1.0/invoke/orderprocessor/method/checkout
8080
```
8181

82+
## TLS authentication
83+
84+
Using the [HTTPEndpoint resource]({{< ref httpendpoints-schema.md >}}) allows you to use any combination of a root certificate, client certificate and private key according to the authentication requirements of the remote endpoint.
85+
86+
### Example using root certificate
87+
88+
```yaml
89+
apiVersion: dapr.io/v1alpha1
90+
kind: HTTPEndpoint
91+
metadata:
92+
name: "external-http-endpoint-tls"
93+
spec:
94+
baseUrl: https://service-invocation-external:443
95+
headers:
96+
- name: "Accept-Language"
97+
value: "en-US"
98+
clientTLS:
99+
rootCA:
100+
secretKeyRef:
101+
name: dapr-tls-client
102+
key: ca.crt
103+
```
104+
105+
### Example using client certificate and private key
106+
107+
```yaml
108+
apiVersion: dapr.io/v1alpha1
109+
kind: HTTPEndpoint
110+
metadata:
111+
name: "external-http-endpoint-tls"
112+
spec:
113+
baseUrl: https://service-invocation-external:443
114+
headers:
115+
- name: "Accept-Language"
116+
value: "en-US"
117+
clientTLS:
118+
certificate:
119+
secretKeyRef:
120+
name: dapr-tls-client
121+
key: tls.crt
122+
privateKey:
123+
secretKeyRef:
124+
name: dapr-tls-key
125+
key: tls.key
126+
```
127+
82128
## Related Links
83129
84130
- [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}})

daprdocs/content/en/reference/resource-specs/httpendpoints-schema.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ spec:
2727
secretKeyRef:
2828
name: <REPLACE-WITH-SECRET-NAME>
2929
key: <REPLACE-WITH-SECRET-KEY>
30+
clientTLS:
31+
rootCA:
32+
secretKeyRef:
33+
name: <REPLACE-WITH-SECRET-NAME>
34+
key: <REPLACE-WITH-SECRET-KEY>
35+
certificate:
36+
secretKeyRef:
37+
name: <REPLACE-WITH-SECRET-NAME>
38+
key: <REPLACE-WITH-SECRET-KEY>
39+
privateKey:
40+
secretKeyRef:
41+
name: <REPLACE-WITH-SECRET-NAME>
42+
key: <REPLACE-WITH-SECRET-KEY>
3043
scopes: # Optional
3144
- <REPLACE-WITH-SCOPED-APPIDS>
3245
auth: # Optional
@@ -39,6 +52,7 @@ auth: # Optional
3952
|--------------------|:--------:|---------|---------|
4053
| baseUrl | Y | Base URL of the non-Dapr endpoint | `"https://api.github.com"`, `"http://api.github.com"`
4154
| headers | N | HTTP request headers for service invocation | `name: "Accept-Language" value: "en-US"` <br/> `name: "Authorization" secretKeyRef.name: "my-secret" secretKeyRef.key: "myGithubToken" `
55+
| clientTLS | N | Enables TLS authentication to an endpoint with any standard combination of root certificate, client certificate and private key
4256

4357
## Related links
4458

0 commit comments

Comments
 (0)