Skip to content

Commit 51c19ec

Browse files
committed
auth doc update
1 parent 2382e5c commit 51c19ec

15 files changed

Lines changed: 376 additions & 44 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,6 @@ node_modules/
215215

216216
# Radius generated artefacts
217217
radius/types.tgz
218+
219+
**/*.cer
220+
**/*.crt

‎README.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ Adaptive Apps redefine how applications are built and operated by enabling them
2222

2323
Adaptive Apps is comprised of four layers: application model, programming model, application platform and AI-powered tooling. Rather than redefining these concepts from the ground up, Adaptive Apps leverage proven open-source and cloud-native technologies, such as [Radius](https://docs.radapp.io/), [Dapr](https://dapr.io/), and Azure Arc, and orchestrate them into an end-to-end solution.
2424

25-
![Portable Apps Architecture](./docs/images/portable-apps-architecture.png)
25+
<p align="center">
26+
<img src="./docs/images/portable-apps-architecture.png" width="75%" />
27+
</p>
2628

2729
### **Platform-agnostic application model**
2830

@@ -91,3 +93,7 @@ As an initial capability, Adaptive Apps provide AI-based refactoring tools that
9193
## Getting Started
9294

9395
Follow our [getting-started tutorial](./tutorials/getting-started/README.md) to deploy a Adaptive App across cloud and edge environments.
96+
97+
## Topics
98+
99+
* [Authentication](./docs/authentication/README.md)

‎charts/portfolios/compute-core/README.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,43 @@ This folder contains a single Helm chart for the `compute-core` portfolio.
1111

1212
- Keycloak identity provider (`components.keycloak.enabled=true`)
1313

14+
### Optional Keycloak certificate mount
15+
16+
You can provide an optional certificate file (`.crt`) that will be stored in a
17+
Kubernetes Secret and mounted into the Keycloak pod.
18+
19+
Example values override:
20+
21+
```yaml
22+
keycloak:
23+
customCert:
24+
crt: |
25+
-----BEGIN CERTIFICATE-----
26+
MIIC...
27+
-----END CERTIFICATE-----
28+
fileName: custom-ca.crt
29+
mountPath: /opt/keycloak/conf/certs
30+
```
31+
32+
When `keycloak.customCert.crt` is empty (default), no Secret or mount is created.
33+
34+
### Optional Keycloak hostname mapping (domain controller host)
35+
36+
You can inject static host-to-IP mappings into the Keycloak pod via Kubernetes
37+
`hostAliases` so a domain controller hostname resolves without external DNS changes.
38+
39+
Example values override:
40+
41+
```yaml
42+
keycloak:
43+
hostAliases:
44+
- ip: "10.0.0.10"
45+
hostnames:
46+
- dc01.contoso.local
47+
```
48+
49+
This adds an `/etc/hosts` entry inside the Keycloak pod.
50+
1451
Additional `compute-core` capabilities can be added as optional components under the same chart.
1552

1653
## Release target
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if and .Values.components.keycloak.enabled .Values.keycloak.customCert.crt }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "computeCore.keycloak.serviceName" . }}-custom-cert
6+
labels:
7+
{{- include "computeCore.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: keycloak
9+
type: Opaque
10+
stringData:
11+
{{ .Values.keycloak.customCert.fileName | quote }}: |
12+
{{ .Values.keycloak.customCert.crt | nindent 4 }}
13+
{{- end }}

‎charts/portfolios/compute-core/templates/keycloak-deployment.yaml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ spec:
2323
{{- else if .Values.serviceAccount.name }}
2424
serviceAccountName: {{ .Values.serviceAccount.name }}
2525
{{- end }}
26+
{{- with .Values.keycloak.hostAliases }}
27+
hostAliases:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
{{- if .Values.keycloak.customCert.crt }}
31+
volumes:
32+
- name: keycloak-custom-cert
33+
secret:
34+
secretName: {{ include "computeCore.keycloak.serviceName" . }}-custom-cert
35+
{{- end }}
2636
securityContext:
2737
{{- toYaml .Values.keycloak.podSecurityContext | nindent 8 }}
2838
containers:
@@ -42,6 +52,12 @@ spec:
4252
protocol: TCP
4353
securityContext:
4454
{{- toYaml .Values.keycloak.securityContext | nindent 12 }}
55+
{{- if .Values.keycloak.customCert.crt }}
56+
volumeMounts:
57+
- name: keycloak-custom-cert
58+
mountPath: {{ .Values.keycloak.customCert.mountPath | quote }}
59+
readOnly: true
60+
{{- end }}
4561
env:
4662
- name: KC_DB
4763
value: postgres
@@ -89,6 +105,10 @@ spec:
89105
value: ispn
90106
- name: KC_CACHE_STACK
91107
value: kubernetes
108+
{{- if .Values.keycloak.customCert.crt }}
109+
- name: KC_TRUSTSTORE_PATHS
110+
value: {{ .Values.keycloak.customCert.mountPath | quote }}
111+
{{- end }}
92112
- name: JAVA_OPTS_APPEND
93113
value: "-Djgroups.dns.query={{ include "computeCore.keycloak.discoveryServiceName" . }}"
94114
startupProbe:

‎charts/portfolios/compute-core/values.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ keycloak:
4646
runAsNonRoot: true
4747
runAsUser: 1000
4848

49+
hostAliases: []
50+
51+
customCert:
52+
crt: ""
53+
fileName: custom-ca.crt
54+
mountPath: /opt/keycloak/conf/certs
55+
4956
postgresql:
5057
enabled: true
5158
image:

‎collateral/sample-values.yaml‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
nameOverride: ""
2+
fullnameOverride: ""
3+
4+
commonLabels: {}
5+
6+
components:
7+
keycloak:
8+
enabled: true
9+
10+
serviceAccount:
11+
create: false
12+
name: ""
13+
14+
keycloak:
15+
replicaCount: 2
16+
image:
17+
repository: quay.io/keycloak/keycloak
18+
tag: "26.5.5"
19+
pullPolicy: IfNotPresent
20+
21+
admin:
22+
username: admin
23+
password: admin
24+
25+
resources: {}
26+
27+
service:
28+
type: ClusterIP
29+
port: 8080
30+
31+
ingress:
32+
enabled: false
33+
className: ""
34+
annotations: {}
35+
hosts:
36+
- host: keycloak.localtest.me
37+
paths:
38+
- path: /
39+
pathType: Prefix
40+
tls: []
41+
42+
podSecurityContext:
43+
fsGroup: 1000
44+
45+
securityContext:
46+
runAsNonRoot: true
47+
runAsUser: 1000
48+
49+
hostAliases:
50+
- ip: "192.168.50.239"
51+
hostnames:
52+
- "win-4pdsijrpinj.corp.local"
53+
54+
customCert:
55+
crt: ""
56+
fileName: custom-ca.crt
57+
mountPath: /opt/keycloak/conf/certs
58+
59+
postgresql:
60+
enabled: true
61+
image:
62+
repository: mirror.gcr.io/postgres
63+
tag: "17"
64+
pullPolicy: IfNotPresent
65+
66+
auth:
67+
database: keycloak
68+
username: keycloak
69+
password: keycloak
70+
71+
persistence:
72+
enabled: true
73+
size: 2Gi
74+
storageClass: ""
75+
76+
resources: {}
77+
78+
externalDatabase:
79+
host: ""
80+
port: 5432
81+
database: keycloak
82+
username: keycloak
83+
password: ""

‎docs/authentication/README.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Authentication
2+
3+
Adaptive Apps uses a claims-based architecture for authentication, where an application delegates authentication to a trusted identity provider. The identity provider authenticates users using their credentials and issues a security token to the application. The application then validates the token and extracts the claims it contains. These claims can be used by the application to make authorization decisions.
4+
5+
## User authentication
6+
7+
Adaptive Apps capability profiles use [KeyCloak](https://www.keycloak.org/) as a locally deployable identity provider. In production environments, Keycloak is typically configured with federated identity, integrating with upstream identity providers such as Microsoft Entra ID or Active Directory.
8+
9+
Once an Adaptive App capability profile is deployed, you can acess KeyCloak portal locally by:
10+
11+
1. Port forward to KeyCloak portal
12+
13+
```bash
14+
kubectl port-forward -n compute-core svc/compute-core-keycloak 8080:8080
15+
```
16+
17+
2. Open `http://localhost:8080` and sign in with the chart values:
18+
19+
- username: `admin`
20+
- password: `admin`
21+
22+
Then, you can use KeyCloak portal to manage users and credentials.
23+
24+
## Service authentication
25+
26+
Adaptive Apps uses workload identity based on Kubernetes service accounts for service-to-service authentication. Each service runs in a Kubernetes pod associated with a service account. This service account represents the workload’s identity and can be used to obtain a security token from an identity provider.
27+
28+
Two patterns are supported depending on the environment:
29+
30+
### Local / self-managed environments
31+
32+
In local Kubernetes or Arc-enabled clusters, services authenticate using OIDC tokens issued via Keycloak:
33+
1. A service account is mapped to a Keycloak client or identity
34+
2. The workload obtains an access token from Keycloak (e.g., via client credentials or token exchange)
35+
3. The token is used to call downstream services
36+
4. Services validate the token and extract claims for authorization.
37+
38+
### Azure environments
39+
40+
In Azure environments, Adaptive Apps leverages workload identity integration with Microsoft Entra ID.
41+
1. Kubernetes service accounts are federated with Entra ID identities
42+
2. Pods receive tokens via workload identity (OIDC federation)
43+
3. Tokens are used to access Azure services or other APIs securely
44+
4. No secrets are stored in the application
45+
46+
## Additional Topics
47+
48+
* [Configure KeyCloak with local Active Directory](./keycloak-active-directory.md)
49+
* [Sync Active Directory Credentials to Azure Entra tenant](./microsoft-entra-connect.md)

‎docs/authentication/adds-vm.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Setting up Active Directory Domain Services (ADDS) on a VM
2+
3+
### Prerequisites
4+
5+
* A hypervisor such as Hyper-V and VirtualBox.
6+
7+
### Steps
8+
9+
1. Download a Windows Server 2025 evaluation ISO image from: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2025.
10+
2. Create a new VM with the above image (2GB RAM, 100GB Disk is enough).
11+
* Choose **Windows Server 2025 Standard Evaluation (Desktop Experience)**
12+
3. Add **Active Directory Domain Services** role and **Active Directory Certificate Services** role to the server.
13+
4. Promote the server to a domain controller:
14+
* Select "Add a new forest" with root domain name **corp.local**
15+
16+
(reboot to join the domain)
17+
5. Finish Certificate Service configuration:
18+
* Select "Certificate Authority" for role services to configure
19+
* Set "corp-ca" as the common name
20+
6. Launch Manage computer certificate (certlm)
21+
7. Right-click "Personal"->"Certificates" and select "All Tasks"->"Request New Certificate"
22+
8. Select "Domain Controller Authentication" and click on "Enroll"
23+
24+
(reboot)
25+
26+
9. Export the certificate in step 8 to a .CER file, i.e. **dc.cer**. Copy to your local machine
27+
10. On your local machine, convert the certificate to .CRT:
28+
```bash
29+
openssl x509 -inform der -in dc.cer -out dc.crt
30+
```
31+
32+
33+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# KeyCloak federation with Active Directory
2+
3+
## Deploy KeyCloak
4+
5+
You can deploy KeyCloak by installing one of the Adaptive Apps capability portfolios. Once an Adaptive App capability profile is deployed, you can acess KeyCloak portal locally by:
6+
7+
1. Port forward to KeyCloak portal
8+
9+
```bash
10+
kubectl port-forward -n compute-core svc/compute-core-keycloak 8080:8080
11+
```
12+
13+
2. Open `http://localhost:8080` and sign in with the chart values:
14+
15+
- username: `admin`
16+
- password: `admin`
17+
18+
Then, you can use KeyCloak portal to manage users and credentials.
19+
20+
## Setting up Active Directory Domain Services (ADDS) on a VM
21+
22+
See instructions [here](./adds-vm.md).
23+
24+
## Configuring user federation
25+
26+
1. Login to KeyCloak portal
27+
2. Select **User fedreation**, then **Add Ldap providers**
28+
3. Enter these values:
29+
30+
* **Connection URL**: ldaps://`<domain controller host name>`:636
31+
32+
> **NOTE**: The host name needs to be consistent with certificate subject name
33+
34+
* **Enable StartTLS** : Off
35+
* **Use Truststore SPI**: Always
36+
* **Connection pooling**: On
37+
38+
4. Use "Test Connection" button to verify connection.
39+
5. Enter these bind values:
40+
41+
* **Bind type**: simple
42+
* **Bind DN**: CN=Administrator,CN=Users,DC=corp,DC=local
43+
* **Bind credentials**: `<Administrator password>`
44+
6. In "LDAP searching and updating" section:
45+
46+
* **Edit mode**: READ_ONLY
47+
* **Users DN**: CN=Users,DC=corp,DC=local
48+
* **Username LDAP attribute**: sAMAccountName
49+
* **RDN LDAP attribute**: cn
50+
* **UUID LDAP attribute**: objectGUID
51+
* **User object classes**: person, organizationalPerson, user
52+
* **Search scope**: One Level
53+
7. Click "Save"
54+
8. At the top of the screen, select "Action"->"Sync all users" to test. You should see users added/updated message.
55+
9. In KeyCloak portal, click on "Clients" in the left panel.
56+
10. Click on "Create client" button.
57+
11. Enter a client id and click "Next".
58+
12. Set "Client authentication" to On.
59+
13. Set "Valid redriect URIs" to "http://localhost:3000/*" (this is the app frontend URL).
60+
14. Click "Save".
61+
15. Go to "Credentails", copy "Client Secret". You'll need to supply this to your app Radius deployment.

0 commit comments

Comments
 (0)