Harbor
This guide walks you through connecting Harbor to Nauthera so that users can sign in with their Nauthera account and have Harbor project roles assigned automatically based on group membership.
What you will set up
- OIDC sign-in for Harbor via Nauthera
- Automatic group sync so Harbor project membership follows Nauthera groups
- Optional: restrict access to specific groups
Prerequisites
- A running Nauthera instance with a reachable issuer URL (e.g.
https://auth.example.com) - Harbor 2.9+ deployed and accessible
- A
ClusterAuthPolicyorAuthPolicythat includes thegroupsscope
Step 1 — Create the OidcClient
apiVersion: auth.nauthera.io/v1alpha1
kind: OidcClient
metadata:
name: harbor
namespace: harbor
spec:
displayName: Harbor Registry
redirectUris:
- "https://harbor.example.com/c/oidc/callback"
allowedScopes:
- openid
- profile
- email
- groups
grantTypes:
- authorization_code
- refresh_tokenkubectl apply -f harbor-oidc-client.yamlRetrieve the generated credentials:
CLIENT_ID=$(kubectl get secret harbor-credentials -n harbor -o jsonpath='{.data.client_id}' | base64 -d)
CLIENT_SECRET=$(kubectl get secret harbor-credentials -n harbor -o jsonpath='{.data.client_secret}' | base64 -d)
echo "Client ID: $CLIENT_ID"
echo "Client Secret: $CLIENT_SECRET"Step 2 — Enable the groups scope
Ensure your policy includes the groups scope and claim mapping:
apiVersion: auth.nauthera.io/v1alpha1
kind: ClusterAuthPolicy
metadata:
name: default
spec:
scopes:
- openid
- profile
- email
- groups
claimMappings:
- claim: groups
attribute: groupsStep 3 — Configure Harbor
Via Harbor UI
- Log in to Harbor as admin.
- Go to Administration > Configuration > Authentication.
- Set Auth Mode to
OIDC. - Fill in the fields:
| Field | Value |
|---|---|
| OIDC Provider Name | Nauthera |
| OIDC Endpoint | https://auth.example.com |
| OIDC Client ID | Value from Step 1 |
| OIDC Client Secret | Value from Step 1 |
| Group Claim Name | groups |
| OIDC Scope | openid,profile,email,groups |
| Verify Certificate | true (if using valid TLS) |
| Automatic onboarding | true |
| Username Claim | preferred_username or email |
- Click Test OIDC Server to verify connectivity.
- Click Save.
Via Helm values (harbor chart)
# values.yaml
externalURL: "https://harbor.example.com"
core:
configureUserSettings: |
{
"auth_mode": "oidc_auth",
"oidc_name": "Nauthera",
"oidc_endpoint": "https://auth.example.com",
"oidc_client_id": "<your-client-id>",
"oidc_client_secret": "<your-client-secret>",
"oidc_groups_claim": "groups",
"oidc_scope": "openid,profile,email,groups",
"oidc_auto_onboard": true,
"oidc_user_claim": "preferred_username",
"oidc_verify_cert": true
}Step 4 — Map groups to Harbor projects
Harbor maps OIDC groups to project membership. After the first OIDC login, configure group access per project:
- Go to a Harbor project (e.g.
my-app). - Click Members > + Group.
- Enter the Nauthera group name (e.g.
dev-team). - Select the role:
| Harbor Role | Permissions |
|---|---|
| Project Admin | Full project management |
| Maintainer | Push, pull, scan, manage tags |
| Developer | Push and pull images |
| Guest | Pull images only |
| Limited Guest | Pull from specific repositories only |
- Click OK.
Any user in the dev-team Nauthera group will now have the assigned role when they access that project.
Step 5 — Verify
- Open Harbor and click Login via OIDC Provider.
- Authenticate at the Nauthera login page.
- After redirect, check your Harbor profile — username and email should be populated.
- Navigate to a project — your role should match the group mapping from Step 4.
- Test Docker CLI access:
docker login harbor.example.com
# Use your Harbor username and CLI secret (generated in Harbor profile)
docker pull harbor.example.com/my-app/my-image:latestRestricting access
Add requiredGroups to the OidcClient to limit who can sign in:
spec:
requiredGroups:
- harbor-admins
- dev-teamTroubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| "Failed to verify ID token" | Issuer URL mismatch or clock skew | Ensure oidc_endpoint matches Nauthera's issuerUrl exactly |
| Groups not appearing in Harbor | groups claim not in token | Add groups to policy scopes and claimMappings |
| Redirect loop | Incorrect callback URL | Ensure redirect URI ends with /c/oidc/callback |
| "Unauthorized" after login | User not mapped to any project | Add the user's group to a Harbor project |
| Docker login fails | CLI secret not set | Go to Harbor profile and generate a CLI secret |
Related
- OidcClient — Full CRD reference
- AuthPolicy — Scope and claim mapping configuration
- User Management — Creating users and groups
- SCIM 2.0 — Automatic group sync from your directory