feat: Setup GitHub as identity provider

This commit is contained in:
2025-01-28 10:43:00 +01:00
parent d72f58a97d
commit 4e8bdbf2e4
2 changed files with 42 additions and 4 deletions
+30 -4
View File
@@ -11,13 +11,13 @@ resource "keycloak_realm" "twomartens_realm" {
realm = "twomartens"
enabled = true
display_name = "2martens Applications"
display_name = "2martens Applications"
display_name_html = "<div class=\"kc-logo-text\"><span>2martens</span></div>"
login_theme = "keycloak.v2"
login_theme = "keycloak.v2"
account_theme = "keycloak.v3"
admin_theme = "keycloak.v2"
email_theme = "keycloak"
admin_theme = "keycloak.v2"
email_theme = "keycloak"
# Security settings
password_policy = "upperCase(1) and length(12) and forceExpiredPasswordChange(365) and notUsername"
@@ -29,3 +29,29 @@ resource "keycloak_realm" "twomartens_realm" {
}
}
}
resource "keycloak_oidc_identity_provider" "twomartens_github_identity_provider" {
realm = keycloak_realm.twomartens_realm.id
alias = "github"
display_name = "GitHub"
provider_id = "github"
# OAuth App Configuration
client_id = var.github_identity_provider_client_id
client_secret = var.github_identity_provider_client_secret
# OAuth Endpoints
authorization_url = "https://github.com/login/oauth/authorize"
token_url = "https://github.com/login/oauth/access_token"
# Detailed User Mapping
extra_config = {
"clientAuthMethod" = "client_secret_post"
}
# Scopes and Sync Settings
sync_mode = "IMPORT"
# Logout and UI Settings
ui_locales = true
}
+12
View File
@@ -97,3 +97,15 @@ variable "keycloak_url" {
description = "URL of the Keycloak server"
type = string
}
variable "github_identity_provider_client_id" {
description = "Client ID of the GitHub identity provider"
type = string
sensitive = true
}
variable "github_identity_provider_client_secret" {
description = "Client Secret of the GitHub identity provider"
type = string
sensitive = true
}