diff --git a/terraform/keycloak.tf b/terraform/keycloak.tf
index a9700b3..f6f0af9 100644
--- a/terraform/keycloak.tf
+++ b/terraform/keycloak.tf
@@ -11,13 +11,13 @@ resource "keycloak_realm" "twomartens_realm" {
realm = "twomartens"
enabled = true
- display_name = "2martens Applications"
+ display_name = "2martens Applications"
display_name_html = "
2martens
"
- 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
+}
diff --git a/terraform/variables.tf b/terraform/variables.tf
index 4b89d1c..9930fc8 100644
--- a/terraform/variables.tf
+++ b/terraform/variables.tf
@@ -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
+}
\ No newline at end of file