본문으로 건너뛰기

Dex에 Google 연결하기

OAuth client 생성

  1. https://console.cloud.google.com/
  2. APIs & Services -> Credentials 페이지로 이동합니다.
  3. Create credentials -> OAuth client ID를 클릭합니다.
  4. Application type으로 Web application을 선택합니다.
  5. Name, Authorized redirect URIs를 입력합니다.
  6. Create를 클릭합니다.

설정

dex-values.yaml
config:
connectors:
- type: google
id: google
name: Google
config:
clientID: <clientID>
clientSecret: <clientSecret>
redirectURI: <issuerURI>/callback
promptType: ""

groups 가져오기

Service account 생성

  1. https://console.cloud.google.com/
  2. IAM & Admin -> Service Accounts 페이지로 이동합니다.
  3. Create service account를 클릭합니다.
  4. Service account name을 입력하고 Create and continue를 클릭합니다.
  5. Done을 클릭합니다.

Credential 생성

  1. https://console.cloud.google.com/
  2. IAM & Admin -> Service Accounts 페이지로 이동합니다.
  3. 생성한 Service account를 클릭합니다.
  4. Keys 탭으로 이동합니다.
  5. Add Key -> Create new key를 클릭합니다.
  6. JSON을 선택 후 Create를 클릭합니다.

생성하면 자동으로 JSON 파일이 다운로드됩니다.

Domain-wide delegation 설정

  1. https://console.cloud.google.com/
  2. IAM & Admin -> Service Accounts 페이지로 이동합니다.
  3. 생성한 Service account를 클릭합니다.
  4. Advanced settings를 확장합니다.
  5. Client ID를 복사합니다.
  6. View Google Workspace Admin Console을 클릭합니다.(super administrator)
  7. Security -> Access and data control -> API controls 페이지로 접속합니다.
  8. MANAGE DOMAIN WIDE DELEGATION을 클릭합니다.
  9. Add new를 클릭한 후 복사한 Client ID를 입력합니다.
  10. OAuth scopes에 https://www.googleapis.com/auth/admin.directory.group.readonly를 입력합니다.
  11. AUTHORIZE를 클릭합니다.

Admin SDK API 활성화

  1. https://console.cloud.google.com/
  2. APIs & Services -> Enabled APIs & services 페이지로 이동합니다.
  3. Enable APIs and services를 클릭합니다.
  4. Admin SDK를 검색합니다.
  5. Admin SDK API를 클릭합니다.
  6. Enable을 클릭합니다.

Admin Email 설정

  1. https://admin.google.com/
  2. Account -> Admin roles 페이지로 이동합니다.
  3. Groups Reader를 클릭합니다.
  4. 사용할 Email을 추가합니다.

설정 적용하기

apiVersion: v1
kind: Secret
metadata:
name: dex-google-service-account
namespace: dex
type: Opaque
data:
googleAuth.json: <googleAuth.json | base64 | tr -d '\n'>
dex-values.yaml
config:
connectors:
- type: google
config:
serviceAccountFilePath: /etc/dex/google-auth/googleAuth.json
domainToAdminEmail:
# example.com: [email protected]
<domain>: <adminEmail>

volumes:
- name: google-auth
secret:
secretName: dex-google-service-account

volumeMounts:
- name: google-auth
mountPath: /etc/dex/google-auth