SAML 인증 설정
SAML 인증 설정 (Set up SAML authentication)
이 문서는 SAML 플러그인을 익명(anonymous) Consumer와 함께 구성해서 SAML 인증을 활성화하는 방법을 안내해요. 필요한 사전 준비물과 환경 변수를 먼저 확인하고, decK, Admin API, Konnect API 중 편한 방식으로 플러그인을 설정할 수 있어요. Microsoft Entra를 활용한 전체 how-to 가이드가 필요하면 소개된 링크를 참고해 보세요
출처: 문서
본문
SAML 인증 설정v3.1+
익명 Consumer를 사용해서 SAML 인증을 활성화하도록 플러그인을 구성해요.
전체 how-to 가이드는 Microsoft Entra를 사용해 Kong Gateway에 SAML 인증 활성화하기를 참고하세요.
전제 조건
-
SAML 애플리케이션
-
익명 Consumer
환경 변수
-
IDENTIFIER: 여러분의 SAML 애플리케이션 식별자예요. -
LOGIN_URL: 여러분의 SAML 로그인 URL이에요. -
CERTIFICATE: SAML 프로바이더 인증서 내용이에요(Base64).
플러그인 설정하기
전역
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: saml
config:
anonymous: anonymous
issuer: ${{ env "DECK_IDENTIFIER" }}
idp_sso_url: ${{ env "DECK_LOGIN_URL" }}
assertion_consumer_path: "/consume"
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: ${{ env "DECK_CERTIFICATE" }}
{: data-file="kong.yaml" data-tool="deck" }
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
-
region: Kong Konnect가 호스팅되고 운영되는 지역이에요. -
KONNECT_TOKEN: Konnect 계정과 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요.
지역별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API reference를 참고하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
labels:
global: 'true'
config:
anonymous: anonymous
issuer: '$IDENTIFIER'
idp_sso_url: '$LOGIN_URL'
assertion_consumer_path: '/consume'
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: '$CERTIFICATE'
plugin: saml
" | kubectl apply -f -
Terraform
전제 조건: 개인 액세스 토큰 구성하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway 플러그인을 생성하려면 Terraform 구성에 다음을 추가하세요:
resource "konnect_gateway_plugin_saml" "my_saml" {
enabled = true
config = {
anonymous = "anonymous"
issuer = var.identifier
idp_sso_url = var.login_url
assertion_consumer_path = "/consume"
validate_assertion_signature = true
session_secret = "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07"
idp_certificate = var.certificate
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
}
이 예제에서는 다음 변수를 매니페스트에 추가해야 해요. TF_VAR_name=value 형식으로 설정하면 런타임에 값을 지정할 수 있어요.
variable "identifier" {
type = string
}
variable "login_url" {
type = string
}
variable "certificate" {
type = string
}
서비스
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: saml
service: serviceName|Id
config:
anonymous: anonymous
issuer: ${{ env "DECK_IDENTIFIER" }}
idp_sso_url: ${{ env "DECK_LOGIN_URL" }}
assertion_consumer_path: "/consume"
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: ${{ env "DECK_CERTIFICATE" }}
{: data-file="kong.yaml" data-tool="deck" }
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
serviceName|Id: 플러그인 구성이 대상으로 할 서비스의id또는name이에요.
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/services/{serviceName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
serviceName|Id: 플러그인 구성이 대상으로 할 서비스의id또는name이에요.
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/services/{serviceId}/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
-
region: Kong Konnect가 호스팅되고 운영되는 지역이에요. -
KONNECT_TOKEN: Konnect 계정과 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요. -
serviceId: 플러그인 구성이 대상으로 할 서비스의id예요.
지역별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API reference를 참고하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
anonymous: anonymous
issuer: '$IDENTIFIER'
idp_sso_url: '$LOGIN_URL'
assertion_consumer_path: '/consume'
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: '$CERTIFICATE'
plugin: saml
" | kubectl apply -f -
다음으로, service 리소스에 어노테이션을 붙여서 KongPlugin 리소스를 적용하세요:
kubectl annotate -n kong service SERVICE_NAME konghq.com/plugins=
Terraform
전제 조건: 개인 액세스 토큰 구성하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway 플러그인을 생성하려면 Terraform 구성에 다음을 추가하세요:
resource "konnect_gateway_plugin_saml" "my_saml" {
enabled = true
config = {
anonymous = "anonymous"
issuer = var.identifier
idp_sso_url = var.login_url
assertion_consumer_path = "/consume"
validate_assertion_signature = true
session_secret = "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07"
idp_certificate = var.certificate
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
service = {
id = konnect_gateway_service.my_service.id
}
}
이 예제에서는 다음 변수를 매니페스트에 추가해야 해요. TF_VAR_name=value 형식으로 설정하면 런타임에 값을 지정할 수 있어요.
variable "identifier" {
type = string
}
variable "login_url" {
type = string
}
variable "certificate" {
type = string
}
라우트
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: saml
route: routeName|Id
config:
anonymous: anonymous
issuer: ${{ env "DECK_IDENTIFIER" }}
idp_sso_url: ${{ env "DECK_LOGIN_URL" }}
assertion_consumer_path: "/consume"
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: ${{ env "DECK_CERTIFICATE" }}
{: data-file="kong.yaml" data-tool="deck" }
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
routeName|Id: 플러그인 구성이 대상으로 할 라우트의id또는name이에요.
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/routes/{routeName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
routeName|Id: 플러그인 구성이 대상으로 할 라우트의id또는name이에요.
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/routes/{routeId}/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "saml",
"config": {
"anonymous": "anonymous",
"issuer": "'$IDENTIFIER'",
"idp_sso_url": "'$LOGIN_URL'",
"assertion_consumer_path": "/consume",
"validate_assertion_signature": true,
"session_secret": "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07",
"idp_certificate": "'$CERTIFICATE'"
}
}
'
다음 플레이스홀더를 여러분의 값으로 바꿔야 해요:
-
region: Kong Konnect가 호스팅되고 운영되는 지역이에요. -
KONNECT_TOKEN: Konnect 계정과 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요. -
routeId: 플러그인 구성이 대상으로 할 라우트의id예요.
지역별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API reference를 참고하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
anonymous: anonymous
issuer: '$IDENTIFIER'
idp_sso_url: '$LOGIN_URL'
assertion_consumer_path: '/consume'
validate_assertion_signature: true
session_secret: uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07
idp_certificate: '$CERTIFICATE'
plugin: saml
" | kubectl apply -f -
다음으로, httproute 또는 ingress 리소스에 어노테이션을 붙여서 KongPlugin 리소스를 적용하세요:
Gateway API
kubectl annotate -n kong httproute konghq.com/plugins=
Ingress
kubectl annotate -n kong ingress konghq.com/plugins=
Terraform
사전 준비: 개인 액세스 토큰 구성하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway Plugin을 생성하려면 Terraform 구성에 다음 내용을 추가하세요:
resource "konnect_gateway_plugin_saml" "my_saml" {
enabled = true
config = {
anonymous = "anonymous"
issuer = var.identifier
idp_sso_url = var.login_url
assertion_consumer_path = "/consume"
validate_assertion_signature = true
session_secret = "uwcLGoTJCWnHWZdVpbLYKlztNOyoGJ07"
idp_certificate = var.certificate
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
route = {
id = konnect_gateway_route.my_route.id
}
}
이 예제에서는 매니페스트에 다음 변수를 추가해야 해요. TF_VAR_name=value를 설정하면 런타임에 값을 지정할 수 있어요.
variable "identifier" {
type = string
}
variable "login_url" {
type = string
}
variable "certificate" {
type = string
}
관련 리소스
더 알아보기 (Learn more)
- Microsoft Entra를 사용해 Kong Gateway에 SAML 인증을 활성화하는 전체 가이드예요 — Enable SAML authentication for Kong Gateway using Microsoft Entra
- Kong Gateway에서 사용할 수 있는 인증 방식 전반을 설명하는 문서예요 — Kong Gateway authentication
- decK로 kong.yaml 구성 파일을 작성하는 시작 가이드예요 —
kong.yaml - Konnect Control Plane 구성 API의 레퍼런스 문서예요 — Konnect Control Planes Config API reference