Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

사용자 사전 등록(Preregister User) (V2)

사용자가 이 인증 제공자로 처음 로그인하기 전에 사용자 이름을 지정해 등록합니다. 사전 등록 후 첫 로그인 전에 그룹과 역할을 할당할 수 있습니다.

username은 제공자의 지원 이름 패턴과 일치해야 합니다. 기본 조직은 필수지만 첫 로그인 때 조직 할당 규칙에 따라 바뀔 수 있습니다. 예시는 .*@example.com 패턴에 맞는 jsmith@example.com을 사용합니다.

이 엔드포인트는 미리보기 기능이며 언제든 변경되거나 제거될 수 있습니다. 사용하려면 preview=true를 지정합니다.

HTTP 요청

POST /api/v2/admin/enrollments/{enrollmentRid}/authenticationProviders/{authenticationProviderRid}/preregisterUser

작업 식별자는 v2.preregisterUser입니다. OAuth2로 호출하는 타사 애플리케이션에는 api:admin-write 권한 범위가 필요합니다. 각 요청에 Authorization: Bearer <접근 토큰>을 전달합니다.

경로 매개변수

이름자료형필수 여부의미와 조건예시 값
enrollmentRidstring필수ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6
authenticationProviderRidstring필수ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86

쿼리 매개변수

이름자료형필수 여부의미와 조건예시 값
previewboolean선택미리보기 기능 사용을 활성화합니다.true

요청 본문

본문 형식은 PreregisterUserRequest이며 필수입니다.

이름자료형필수 여부의미와 조건예시 값
usernamestring필수새 사용자의 사용자 이름입니다. 제공자가 지원하는 사용자 이름 패턴 중 하나와 일치해야 합니다.
organizationstring필수사용자의 기본 조직 RID입니다. 첫 로그인 때 구성된 조직 할당 규칙에 따라 바뀔 수 있습니다.ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa
givenNamestring선택
familyNamestring선택
emailstring선택
attributesmap<AttributeName, AttributeValues>선택본문 예시 참조

attributes의 구조

맵의 키는 AttributeName(string), 값은 AttributeValues(list<AttributeValue>)입니다. 이 이름은 키와 값의 유형 별칭입니다.

배열 항목은 AttributeValue이며 자료형은 string입니다.

다음 본문의 식별자와 값은 가상 예시입니다.

{
  "organization": "ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa",
  "givenName": "John",
  "familyName": "Smith",
  "attributes": {
    "department": [
      "Finance"
    ],
    "jobTitle": [
      "Accountant"
    ]
  },
  "email": "jsmith@example.com",
  "username": "jsmith@example.com"
}

응답

등록한 사용자의 PrincipalId 문자열을 반환합니다.

Foundry 그룹 또는 사용자의 ID입니다.

가상 사전 등록 사용자의 응답 예시입니다.

"f05f8da4-b84c-4fca-9c77-8af0b13d11de"

개별 오류

오류 이름오류 코드HTTP의미와 조건추가 매개변수
PreregisterUserPermissionDeniedPERMISSION_DENIED403해당 인증 제공자에 사용자를 사전 등록할 권한이 없습니다.enrollmentRid, authenticationProviderRid
AuthenticationProviderNotFoundNOT_FOUND404지정한 인증 제공자를 찾을 수 없습니다.enrollmentRid, authenticationProviderRid

요청 예제

FOUNDRY_HOST에는 https://를 제외한 Foundry 호스트를, FOUNDRY_TOKEN에는 유효한 토큰을 환경 변수로 제공합니다. 예시 식별자와 매개변수 값은 실제 작업 대상에 맞게 바꿉니다.

cURL

curl -X POST \
	-H "Content-type: application/json" \
	-H "Authorization: Bearer ${FOUNDRY_TOKEN}" \
	"https://${FOUNDRY_HOST}/api/v2/admin/enrollments/ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6/authenticationProviders/ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86/preregisterUser?preview=true" \
	-d '{"organization":"ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa","givenName":"John","familyName":"Smith","attributes":{"department":["Finance"],"jobTitle":["Accountant"]},"email":"jsmith@example.com","username":"jsmith@example.com"}'

Python

Requests 라이브러리가 설치된 Python 환경에서 사용합니다.

import os
import requests

HOSTNAME = os.environ["FOUNDRY_HOST"]
TOKEN = os.environ["FOUNDRY_TOKEN"]
headers = {
    "content-type": "application/json",
    "authorization": "Bearer {}".format(TOKEN)
}
request_body = {
    "organization": "ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa",
    "givenName": "John",
    "familyName": "Smith",
    "attributes": {
        "department": [
            "Finance"
        ],
        "jobTitle": [
            "Accountant"
        ]
    },
    "email": "jsmith@example.com",
    "username": "jsmith@example.com"
}

response = requests.post('https://{}/api/v2/admin/enrollments/ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6/authenticationProviders/ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86/preregisterUser?preview=true'.format(HOSTNAME), headers=headers, json=request_body)
print(response)

Java

Apache HttpClient 4.5 API와 try-with-resources를 사용합니다. 클래스 이름에 맞는 PreregisterUserExample.java 파일에서 사용합니다.

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;

public class PreregisterUserExample {
    public static void main(String[] args) throws Exception {
        String HOSTNAME = System.getenv("FOUNDRY_HOST");
        String TOKEN = System.getenv("FOUNDRY_TOKEN");

        try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
            HttpPost request = new HttpPost("https://" + HOSTNAME + "/api/v2/admin/enrollments/ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6/authenticationProviders/ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86/preregisterUser?preview=true");
            request.addHeader("content-type", "application/json");
            request.addHeader("authorization", String.format("Bearer %s", TOKEN));
            request.setEntity(new StringEntity("{\"organization\":\"ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa\",\"givenName\":\"John\",\"familyName\":\"Smith\",\"attributes\":{\"department\":[\"Finance\"],\"jobTitle\":[\"Accountant\"]},\"email\":\"jsmith@example.com\",\"username\":\"jsmith@example.com\"}", ContentType.APPLICATION_JSON));
            try (CloseableHttpResponse response = httpClient.execute(request)) {
                System.out.println(response);
            }
        }
    }
}

JavaScript

fetch를 제공하는 Node.js 환경에서 사용합니다. 서비스 사용자 토큰을 브라우저로 전달하지 않습니다.

const HOSTNAME = process.env.FOUNDRY_HOST;
const TOKEN = process.env.FOUNDRY_TOKEN;

fetch(`https://${HOSTNAME}/api/v2/admin/enrollments/ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6/authenticationProviders/ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86/preregisterUser?preview=true`, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${TOKEN}`,
    },
    body: '{"organization":"ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa","givenName":"John","familyName":"Smith","attributes":{"department":["Finance"],"jobTitle":["Accountant"]},"email":"jsmith@example.com","username":"jsmith@example.com"}'
}).then((response) => {
    console.log(response)
});

PowerShell

$TOKEN = $env:FOUNDRY_TOKEN
$HOSTNAME = $env:FOUNDRY_HOST

$headers = @{
    "authorization" = "Bearer $TOKEN"
}

$response = Invoke-WebRequest -Uri "https://$HOSTNAME/api/v2/admin/enrollments/ri.control-panel.main.customer.466f812b-f974-4478-9d4f-90402cd3def6/authenticationProviders/ri.control-panel.main.saml.3faf689c-eaa1-4137-851f-81d58afe4c86/preregisterUser?preview=true" `
	-Method Post `
	-Headers $headers `
	-ContentType application/json `
	-Body "{`"organization`":`"ri.multipass..organization.c30ee6ad-b5e4-4afe-a74f-fe4a289f2faa`",`"givenName`":`"John`",`"familyName`":`"Smith`",`"attributes`":{`"department`":[`"Finance`"],`"jobTitle`":[`"Accountant`"]},`"email`":`"jsmith@example.com`",`"username`":`"jsmith@example.com`"}"

$response.content