mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 19:26:51 +02:00
feat: Setup GitHub as identity provider
This commit is contained in:
+30
-4
@@ -11,13 +11,13 @@ resource "keycloak_realm" "twomartens_realm" {
|
|||||||
realm = "twomartens"
|
realm = "twomartens"
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
||||||
display_name = "2martens Applications"
|
display_name = "2martens Applications"
|
||||||
display_name_html = "<div class=\"kc-logo-text\"><span>2martens</span></div>"
|
display_name_html = "<div class=\"kc-logo-text\"><span>2martens</span></div>"
|
||||||
|
|
||||||
login_theme = "keycloak.v2"
|
login_theme = "keycloak.v2"
|
||||||
account_theme = "keycloak.v3"
|
account_theme = "keycloak.v3"
|
||||||
admin_theme = "keycloak.v2"
|
admin_theme = "keycloak.v2"
|
||||||
email_theme = "keycloak"
|
email_theme = "keycloak"
|
||||||
|
|
||||||
# Security settings
|
# Security settings
|
||||||
password_policy = "upperCase(1) and length(12) and forceExpiredPasswordChange(365) and notUsername"
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -97,3 +97,15 @@ variable "keycloak_url" {
|
|||||||
description = "URL of the Keycloak server"
|
description = "URL of the Keycloak server"
|
||||||
type = string
|
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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user