SMS認証
このドキュメントは、sms-authentication 方式による認証処理の 概要・設定・利用方法 について説明します。
概要
SMS認証は、ユーザーの電話番号にワンタイムコード(OTP)を送信し、それを使って本 人確認を行う多要素認証方式の一つです。
idp-server ではSMS認証機能を2つのパターンで提供します。
- 外部SMS認証サービスを利用したTOTP
- idp-serverで認証コード生成・検証 + 外部SMS送信サービスを利用したTOTP
SMS認証は以下の複数のインタラクションを連続的に実行することで成立します:
sms-authentication-challenge: 認証用ワンタイムコードの送信sms-authentication: ワンタイムコードの検証
設定
設定には type = "sms" の AuthenticationConfiguration をテナントごとに登録する必要があります。
SMS認証は interactions ベースの設定構造を持ち、以下の2つのインタラクションを定義します:
sms-authentication-challenge: SMS送信処理sms-authentication: コード検証処理
トップレベル設定項目
| 項目 | 内容 |
|---|---|
id | 設定ID(UUID形式) |
type | sms 固定 |
metadata | メタデータ(型、パラメータ名など) |
interactions | インタラクション定義(challenge/verify) |
メタデータ設定項目
| 項目 | 内容 |
|---|---|
type | external: 外部SMS認証サービス / internal: 内部OTP生成 |
verification_code_param | 検証コードのパラメータ名(デフォルト: verification_code) |
transaction_id_param | トランザクションIDのパラメータ名(外部サービス利用時) |
設定パターン
パターン1: 外部SMS認証サービスを利用したTOTP
外部のSMS認証APIサービスを利用し、OTP生成・検証を外部に委譲するパターンです。
challenge インタラクション設定
| 項目 | 説明 |
|---|---|
execution.function | http_request 固定 |
execution.http_request | 外部API設定(URL、メソッド、認証、マッピングルール) |
execution.http_request_store | 外部APIレスポンスの保存設定(transaction_idなどを保存) |
response.body_mapping_rules | レスポンスマッピング |
verify インタラクション設定
| 項目 | 説明 |
|---|---|
execution.function | http_request 固定 |
execution.previous_interaction | challenge時に保存したデータの参照キー |
execution.http_request | 外部検証API設定 |
execution.http_request.body_mapping_rules | verification_code と transaction_id のマッピング |
response.body_mapping_rules | レスポンスマッピング |
設定例
{
"id": "0f12803e-37b6-437e-8ca9-5822bd852b74",
"type": "sms",
"metadata": {
"type": "external",
"verification_code_param": "verification_code"
},
"interactions": {
"sms-authentication-challenge": {
"execution": {
"function": "http_request",
"http_request": {
"url": "https://external-sms-service.com/challenge",
"method": "POST",
"oauth_authorization": {
"type": "password",
"token_endpoint": "https://external-sms-service.com/token",
"client_id": "your-client-id",
"username": "username",
"password": "password"
},
"header_mapping_rules": [
{
"static_value": "application/json",
"to": "Content-Type"
}
],
"body_mapping_rules": [
{
"from": "$.request_body",
"to": "*"
}
]
},
"http_request_store": {
"key": "sms-authentication-challenge",
"interaction_mapping_rules": [
{
"from": "$.response_body.transaction_id",
"to": "transaction_id"
}
]
}
},
"response": {
"body_mapping_rules": [
{
"from": "$.execution_http_request.response_body",
"to": "*"
}
]
}
},
"sms-authentication": {
"execution": {
"function": "http_request",
"previous_interaction": {
"key": "sms-authentication-challenge"
},
"http_request": {
"url": "https://external-sms-service.com/verify",
"method": "POST",
"oauth_authorization": {
"type": "password",
"token_endpoint": "https://external-sms-service.com/token",
"client_id": "your-client-id",
"username": "username",
"password": "password"
},
"body_mapping_rules": [
{
"from": "$.request_body.verification_code",
"to": "verification_code"
},
{
"from": "$.interaction.transaction_id",
"to": "transaction_id"
}
]
}
},
"response": {
"body_mapping_rules": [
{
"from": "$.execution_http_request.response_body",
"to": "*"
}
]
}
}
}
}