カスタム・ソーシャル・アイデンティティ・プロバイダを使用した認証

カスタム・ソーシャル・アイデンティティ・プロバイダ(IdP)を使用して認証するようにアイデンティティ・ドメインを構成します。

次の例を使用して、カスタム・ソーシャル・アイデンティティ・プロバイダのメタデータを設定できます。

メタデータは/admin/v1/SocialIdentityProviderMetadataにポストする必要があります。
  • グローバル・レベル・プロバイダを追加するには、<domainURL>/admin/v1/SocialIdentityProviderMetadataエンドポイントを起動します。
  • テナント・レベル・プロバイダを追加するには、<idcs-oracle-url>/admin/v1/SocialIdentityProviderMetadataエンドポイントを起動します。
ノート

グローバル・レベルとテナント・レベルの両方で、同じ名前のカスタム・ソーシャル・アイデンティティ・プロバイダがSocialIdentityProviderMetadataを使用して定義されている場合、テナント・レベルで定義されたカスタム・ソーシャル・アイデンティティ・プロバイダが優先されます。
メタデータのロード後、新しいアイデンティティ・プロバイダを作成できます。
  • コンソールから選択します。「セキュリティ」、アイデンティティ・プロバイダ、ソーシャルの追加IdPの順に選択し、新しいアイデンティティ・プロバイダを選択します。
  • /admin/v1/SocialIdentityProviders REST APIから。

新しいカスタム・ソーシャル・アイデンティティ・プロバイダは、ソーシャル・アイデンティティ・プロバイダのいずれかのタイプとして使用できます。

カスタム・ソーシャル・アイデンティティ・プロバイダ・ログインのユース・ケース

これらのログイン・ユースケースでは、プロバイダに応じてAuthorizePhaseloginScopestokenPhaseおよびuserInfoPhaseを変更する方法を示します。

これらのサンプルでは、式($で始まる)は、定数ではないパラメータ値を示します:

  • $socialIdentityProviderは、対応するSocialIdentityProviderリソースを表します。たとえば、$socialIdentityProvider.consumerKeyは、テナント固有のソーシャル・アイデンティティ・プロバイダ・プロファイルで構成されたクライアント・シークレットを示します。
  • ${state}は、認可リクエストをソーシャルIdPに送信する際にアイデンティティ・ドメイン・ランタイムによって生成される状態です。
  • ${redirectUri}は、アイデンティティ・ドメイン・ランタイムによって生成されたテナント固有のコールバックURLです。
  • ${scope}は:
    • ログイン・ユースケースでは、loginScopes属性の値として指定されたスコープ文字列。
    • プロビジョニングのユース・ケースでは、provisioningScopes属性の値として指定されたスコープ文字列。

  • ${clientCredentials}は、Basic認証スキームの認可ヘッダーに必要な、クライアントIDおよびクライアント・シークレットの標準base-64エンコード表現です。
  • ${authorizationCode}は、ソーシャルIdPからのコールバックで受信した認可コードを示します。

次の項では、ログイン・ユース・ケースのサンプル・メタデータとその後に2つの例を示します。次に、プロビジョニング・ユース・ケースのサンプル・メタデータを示します。

カスタム・ソーシャル・アイデンティティ・プロバイダ・ログイン・サンプル・メタデータ

{
	"type": "SampleProviderForLogin",
	"status": "enabled",
	"idAttribute": "email",
	"capabilities": [
		"login"
	],
	"authorizePhase": {
		"loginScopes": "<scope string>",
		"url": "<Authorization endpoint>"
	},
	"authorizePhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "code",
			"name": "response_type"
		},
		{
			"value": "${scope}",
			"name": "scope"
		},
		{
			"value": "${state}",
			"name": "state"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		}
	],
	"tokenPhase": {
		"url": "<Token endpoint>",
		"method": "<HTTP method for Token endpoint - get/post>"
	},
	"tokenPhaseHeaders": [
		{
			"value": "application/json",
			"name": "Accept"
		},
		{
			"value": "Basic ${clientCredentials}",
			"name": "Authorization"
		}
	],
	"tokenPhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "${socialIdentityProvider.consumerSecret}",
			"name": "client_secret"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		},
		{
			"value": "${authorizationCode}",
			"name": "code"
		},
		{
			"value": "authorization_code",
			"name": "grant_type"
		}
	],
	"userInfoPhase": {
		"url": "<UserInfo endpoint>",
		"method": "<HTTP method for UserInfo endpoint - get/post>"
	},
	"userInfoPhaseHeaders": [
		{
			"value": "*/*",
			"name": "Accept"
		},
		{
			"value": "token ${accessToken}",
			"name": "Authorization"
		}
	],
	"userInfoPhaseParameters": [
		{
			"name": "access_token",
			"value": "${accessToken}"
		}
	],
	"userInfoAttributeMappings": [
		{
			"idpAttribute": "firstname",
			"idcsAttribute": "given_name"
		},
		{
			"idpAttribute": "lastname",
			"idcsAttribute": "family_name"
		},
		{
			"idpAttribute": "email.primary",
			"idcsAttribute": "email"
		}
	],
	"iconUrl": "<icon url>",
	"schemas": [
		"urn:ietf:params:scim:schemas:oracle:idcs:SocialIdentityProviderMetadata"
	]
}

カスタム・ソーシャル・アイデンティティ・プロバイダGitHubの例

{
	"type": "GitHub",
	"status": "enabled",
	"idAttribute": "email",
	"capabilities": [
		"login"
	],
	"authorizePhase": {
		"loginScopes": "user user:email",
		"url": "http://github.com/login/oauth/authorize"
	},
	"authorizePhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "code",
			"name": "response_type"
		},
		{
			"value": "${scope}",
			"name": "scope"
		},
		{
			"value": "${state}",
			"name": "state"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		}
	],
	"tokenPhase": {
		"url": "https://github.com/login/oauth/access_token",
		"method": "post"
	},
	"tokenPhaseHeaders": [
		{
			"value": "application/json",
			"name": "Accept"
		},
		{
			"value": "Basic ${clientCredentials}",
			"name": "Authorization"
		}
	],
	"tokenPhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "${socialIdentityProvider.consumerSecret}",
			"name": "client_secret"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		},
		{
			"value": "${authorizationCode}",
			"name": "code"
		},
		{
			"value": "authorization_code",
			"name": "grant_type"
		}
	],
	"userInfoPhase": {
		"url": "https://api.github.com/user",
		"method": "get"
	},
	"userInfoPhaseHeaders": [
		{
			"value": "*/*",
			"name": "Accept"
		},
		{
			"value": "token ${accessToken}",
			"name": "Authorization"
		}
	],
	"userInfoPhaseParameters": [
		{
			"name": "access_token",
			"value": "${accessToken}"
		}
	],
	"userInfoAttributeMappings": [
		{
			"idpAttribute": "name",
			"idcsAttribute": "given_name"
		}
	],
	"iconUrl": "<<iconURL>>",
	"schemas": [
		"urn:ietf:params:scim:schemas:oracle:idcs:SocialIdentityProviderMetadata"
	]
}

アイデンティティ・プロバイダとしてのアイデンティティ・ドメイン(ユーザー名マッピングを使用)

https://{{host}}/admin/v1/IdentitySettings/IdentitySettingsのパッチ操作を使用して、アイデンティティ・ドメインで電子メールをオプションとして設定します。

{
    {
    "schemas": 
		[
            "urn:ietf:params:scim:api:messages:2.0:PatchOp"
        ],
    "Operations": 
        [
            {
                "op": "replace",
                "path": "primaryEmailRequired",
                "value": false
            }
        ]
    }
}

例:

{
	"type": "IDCSProvider",
	"status": "enabled",
	"idAttribute": "preferred_username",
	"capabilities": [
		"login"
	],
	"authorizePhase": {
		"loginScopes": "openid profile email",
		"url": "https://idcs-idp-where-login-happen.identity.oraclecloud.com/oauth2/v1/authorize"
	},
	"authorizePhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "code",
			"name": "response_type"
		},
		{
			"value": "${scope}",
			"name": "scope"
		},
		{
			"value": "${state}",
			"name": "state"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		}
	],
	"tokenPhase": {
		"url": "https://idcs-idp-where-login-happen.identity.oraclecloud.com/oauth2/v1/token",
		"method": "post"
	},
	"tokenPhaseHeaders": [
		{
			"value": "application/x-www-form-urlencoded",
			"name": "Content-Type"
		},
		{
			"value": "Basic ${clientCredentials}",
			"name": "Authorization"
		}
	],
	"tokenPhaseParameters": [
		{
			"value": "${authorizationCode}",
			"name": "code"
		},
		{
			"value": "authorization_code",
			"name": "grant_type"
		}
	],
	"userInfoPhase": {
		"url": "https://idcs-idp-where-login-happen.identity.oraclecloud.com/oauth2/v1/userinfo",
		"method": "get"
	},
	"userInfoPhaseHeaders": [
		{
			"value": "application/x-www-form-urlencoded",
			"name": "Content-Type"
		},
		{
			"value": "Bearer ${accessToken}",
			"name": "Authorization"
		}
	],
	"userInfoPhaseParameters": [
		{
			"name": "access_token",
			"value": "${accessToken}"
		}
	],
	"schemas": [
		"urn:ietf:params:scim:schemas:oracle:idcs:SocialIdentityProviderMetadata"
	]
}

カスタム・ソーシャル・アイデンティティ・プロバイダOktaの例

{
	"type": "OktaTest",
	"status": "enabled",
	"idAttribute": "email",
	"capabilities": [
		"login"
	],
	"authorizePhase": {
		"loginScopes": "openid profile email",
		"url": "<Okta's UserInfo endpoint>"
	},
	"authorizePhaseParameters": [
		{
			"name": "client_id",
			"value": "${socialIdentityProvider.consumerKey}"
		},
		{
			"name": "response_type",
			"value": "code"
		},
		{
			"name": "scope",
			"value": "${scope}"
		},
		{
			"name": "state",
			"value": "${state}"
		},
		{
			"name": "redirect_uri",
			"value": "${redirectUri}"
		}
	],
	"tokenPhase": {
		"url": "<Okta's UserInfo endpoint>",
		"method": "post"
	},
	"tokenPhaseHeaders": [
		{
			"value": "application/json",
			"name": "Accept"
		}
	],
	"tokenPhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "${socialIdentityProvider.consumerSecret}",
			"name": "client_secret"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		},
		{
			"value": "${authorizationCode}",
			"name": "code"
		},
		{
			"value": "authorization_code",
			"name": "grant_type"
		}
	],
	"userInfoPhase": {
		"url": "<Okta's UserInfo endpoint>",
		"method": "post"
	},
	"userInfoPhaseHeaders": [
		{
			"value": "*/*",
			"name": "Accept"
		},
		{
			"value": "Bearer ${accessToken}",
			"name": "Authorization"
		}
	],
	"iconUrl": "<<iconURL>>",
	"schemas": [
		"urn:ietf:params:scim:schemas:oracle:idcs:SocialIdentityProviderMetadata"
	]
}

カスタム・ソーシャル・アイデンティティ・プロバイダのサンプル・メタデータ(プロビジョニング・ユース・ケース用)

{
	"type": "SampleProviderForProvisioning",
	"status": "enabled",
	"capabilities": [
		"provisioning"
	],
	"authorizePhase": {
		"provisioningScopes": "<scope string>",
		"url": "<Authorization endpoint>"
	},
	"authorizePhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "code",
			"name": "response_type"
		},
		{
			"value": "${scope}",
			"name": "scope"
		},
		{
			"value": "${state}",
			"name": "state"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		}
	],
	"tokenPhase": {
		"url": "<Token endpoint>",
		"method": "<HTTP method for Token endpoint - get/post>"
	},
	"tokenPhaseHeaders": [
		{
			"value": "application/json",
			"name": "Accept"
		},
		{
			"value": "Basic ${clientCredentials}",
			"name": "Authorization"
		}
	],
	"tokenPhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "${socialIdentityProvider.consumerSecret}",
			"name": "client_secret"
		},
		{
			"value": "${redirectUri}",
			"name": "redirect_uri"
		},
		{
			"value": "${authorizationCode}",
			"name": "code"
		},
		{
			"value": "authorization_code",
			"name": "grant_type"
		}
	],
	"refreshTokenPhaseHeaders": [
		{
			"value": "application/json",
			"name": "Accept"
		}
	],
	"refreshTokenPhaseParameters": [
		{
			"value": "${socialIdentityProvider.consumerKey}",
			"name": "client_id"
		},
		{
			"value": "${socialIdentityProvider.consumerSecret}",
			"name": "client_secret"
		},
		{
			"value": "${refreshToken}",
			"name": "refresh_token"
		}