---
sourceDocument: Xanadu Now Platform 기능
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ko-KR/xanadu/servicenow-platform

 Release :

    - xanadu

ft:locale :

    - ko-KR

ft:publication_title :

    - Xanadu Now Platform 기능

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# 암호 재설정 연장 스크립트

# 암호 재설정 연장 스크립트 {#ariaid-title1}

* 릴리스 버전: Xanadu
* 
* 업데이트 날짜 2024년 08월 01일
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 소요 시간: 18분

확장 스크립트를 사용하면 자격 증명 스토어, 검증 또는 식별 유형의 기능을 확장할 암호 재설정 수 있습니다.

## 암호 재설정 확장 스크립트 포함 {#pw-reset-ext-script-includes__section_mvb_1bk_h1b}

각 스크립트 포함은 양식의 해당 필드에서 사용할 수 있는 특정 범주와 암호 재설정 연결됩니다.  
주:  
확장 스크립트 양식에서만 암호 재설정 확장 스크립트 생성(암호 재설정확장명새 확장 스크립트). 연장 스크립트는 특수 목적의 스크립트 포함에 포함되며 시스템 정의스크립트 포함 인터페이스. 스크립트 포함을 확장 스크립트로 사용하려면 활성 상태로 설정해야 합니다.

## "등록 확인" 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_m5d_fdw_sbb}

{#pw-reset-ext-script-includes__section_m5d_fdw_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 등록 확인 | 사용자가 지정된 검증에 등록되었는지 확인합니다. | 프로세스(매개변수) | 매개 변수: * params.userId - 확인할 사용자의 sys_id입니다(테이블: sys_user). * params.verificationId - 확인할 검증의 sys_id입니다(테이블: pwd_verification). {#pw-reset-ext-script-includes__ul_qlr_52w_sbb} | 반환: (부울) 사용자가 지정된 검증에 등록된 경우 true; 그렇지 않으면 false입니다. |
[ ]

이 등록 확인 예제에서는 예상 매개 변수가 모두 제공된 경우 사용자가 등록되었음을 알립니다. 이 코드는 SampleEnrollmentCheck라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var SampleEnrollmentCheck = Class.create ();
    SampleEnrollmentCheck. prototype = {
      category:'password_reset.extension.enrollment_check', // DO NOT REMOVE THIS LINE!
     
       /**********
       * Returns boolean telling whether the user is enrolled.
       * This sample returns true if both parameters are supplied, false otherwise 
       *
       * @param params.userId         The sys-id of the user being checked (table: sys_user)
       * @param params.verificationId The sys-id of the verification being checked (table: pwd_verification)
       * @return Boolean indicating whether the user is enrolled into the specified verification
       **********/
      process:function (params) {return (params.userId && params.verificationId)? true:false; },
     
      type:'SampleEnrollmentCheck'};

## "등록 양식 프로세서" 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_jyz_hdw_sbb}

{#pw-reset-ext-script-includes__section_jyz_hdw_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 등록 양식 프로세서 | 사용자로부터 필요한 모든 정보가 수집되었는지 확인합니다. 사용자가 암호를 재설정할 때 확인에 사용할 수 있도록 정보를 저장합니다. | 프로세스(매개변수) | 매개 변수: * params.resetRequestId - 현재 암호 재설정 요청의 sys_id입니다(테이블: pwd_reset_request). * params.userId - 검증할 사용자의 sys_id입니다(테이블: sys_user). * params.verificationId - 처리할 검증의 sys_id입니다(테이블: pwd_verification). * request - 양식 요청 객체입니다. 양식의 필드는 request.getParameter('\<element-id\>')를 사용하여 액세스할 수 있습니다. {#pw-reset-ext-script-includes__ul_g5b_vsz_qp} 등록 프로세스 상태에 다음 정보를 추가해야 합니다. * gs.getSession().putProperty("result.status",status) - 사용자가 성공적으로 등록되었는지 여부입니다. * gs.getSession().putProperty("result.message",message) - UI에 반환될 관련 메시지(예: 자세한 오류 메시지)입니다. * gs.getSession().putProperty("result.value",value) - 등록과 연결된 사용자 지정 값입니다. {#pw-reset-ext-script-includes__ul_nwq_1tz_qp} | 반환: (부울) 사용자가 지정된 검증에 등록된 경우 true; 그렇지 않으면 false입니다. |
[ ]

이 예제에서는 사용자가 제출한 응답이 성공인 경우 등록 양식 제출을 성공적으로 처리합니다. 이 코드는 SampleEnrollmentProcessor라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var SampleEnrollmentProcessor = Class.create ();
    SampleEnrollmentProcessor.prototype = {
        category: 'password_reset.extension.enrollment_form_processor', // DO NOT REMOVE THIS LINE!
     
         /**********
        * Process the enrollment form request, and return whether the user was successfully enrolled.
        * 
        * @param params.userId         The sys_id of the user trying to enroll (table: sys_user)
        * @param params.verificationId The sys_id of the verification to be enrolled into (table: pwd_verification)
        * @param params.enrollmentId   The sys_id of this enrollment process
        * @param request               The form request object. Felds in the form can be accessed with
        *                                           request.getParameter('<element-id>')
        * @return boolean telling whether the user was successfully enrolled
        * The following information should be added to the state of the enrollment process
        *     gs.getSession().putProperty("result.status",status) - whether the user was successfully enrolled
        *     gs.getSession().putProperty("result.message",message) - an associated message to be returned 
        *             to the UI. Eg. a detailed error message
        *     gs.getSession().putProperty("result.value",value) - custom value associated with the enrollment
        **********/
        processForm:function (params, request) {var verificationId = params.verificationId; var sampleInput = request.getParameter ('sample_input');
     
    	 if (gs.nil (verificationId) || (sampleInput!= 'success')) { return false; }
     
    	 var now_GR = new GlideRecord ('sys_user');
    	now_GR.get (params. userId);
    	now_GR.print ('User:' + now_GR.getValue ('user_name') + ' successfully enrolled'); return true; },
        type: 'SampleEnrollmentProcessor' };

## '식별 양식 프로세서' 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_yfh_3dw_sbb}

{#pw-reset-ext-script-includes__section_yfh_3dw_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 식별 양식 프로세서 | ID 양식 요청을 처리합니다. | processForm(매개변수, 요청) | 매개 변수: * params.processId - 호출 암호 재설정 프로세스의 sys_id입니다(테이블: pwd_process). * request - 양식 요청 객체입니다. 양식의 필드는 `request.getParameter('<element-id>')`를 사용하여 액세스할 수 있습니다. `request.getParameter('sysparm_user_id')`를 사용하여 양식에 입력된 사용자 ID를 가져옵니다. {#pw-reset-ext-script-includes__ul_t54_ntz_qp} | 반환: 요청된 입력에 해당하는 사용자의 sys_id입니다. 사용자를 찾을 수 없는 경우 null을 반환합니다. |
[ ]

이 예에서는 식별 양식에서 제출된 사용자 이름이 지정된 sys_user 테이블 내에서 사용자를 식별하려고 시도합니다. 코드는 PwdIdentifyViaUsername이라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var PwdIdentifyViaUsername = Class.create ();
    PwdIdentifyViaUsername. prototype = {
        category: 'password_reset.extension.identification_form_processor', // DO NOT REMOVE THIS LINE!
     
        initialize: function () { },
     
       /**********
       * Process the identification form request, and returns the user's sys_id. If user was not identified return null.
       *
       * @param params.processId   The sys_id of the calling 암호 재설정 process (table: pwd_process)
       * @param request            The form request object. fields in the form can be accessed with
       *  request.getParameter('<element-id>')
       *  Supported request parameters: sysparm_user_id - the user identifier value entered in the form                       
       * @return The sys_id of the user that corresponds to the requested input; 
       *  if no user was found, null should be returned
       **********/
       processForm: function (params, request) {var processId = params. processId; var sysparm_user_id = request.getParameter ('sysparm_user_id');
          now_GR = new GlideRecord ('sys_user') ;
          now_GR.addQuery ('user_name', sysparm_user_id) ;
          now_GR.query (); if (!now_GR.next ()) {return null; } return now_GR.sys_id;},
     
        type:'PwdIdentifyViaUsername' }

## '암호 작성기' 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_njn_3dw_sbb}

{#pw-reset-ext-script-includes__section_njn_3dw_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 암호 생성기 | 자동 생성된 암호를 반환합니다. | 프로세스(매개변수) | Parameters:params.processId - 호출 암호 재설정 프로세스의 sys_id입니다(테이블: pwd_process). | 반환: (문자열) 자동 생성된 암호입니다. |
[ ]

이 예제에서는 기본 단어와 숫자로 암호를 임의로 생성합니다. 자격 증명 스토어에 따라 기본 단어가 선택됩니다. 코드는 SamplePasswordGenerator라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var SamplePasswordGenerator = Class.create ();
    SamplePasswordGenerator. prototype = {
      category: 'password_reset.extension.password_generator', // DO NOT REMOVE THIS LINE!
     
       /**********
       * Returns an auto-generated string password.
       * This sample randomly generates 4 digits to add to the password.
       * 
       * @param params.credentialStoreId The sys_id of the target 암호 재설정 credential store to generate 
       *  a password for (table: pwd_cred_store)
       * @return An auto-generated string password
       **********/
      process:function (params) { var basePassword ;
     
    	 var now_GR = new GlideRecord ('pwd_cred_store');
    	now_GR.addQuery ('name', 'Local ServiceNow Instance');
    	now_GR.query (); if (now_GR.next ()) { if (params.credentialStoreId = now_GR.getValue ('sys_id'))
    			basePassword = "Password"; else
    			basePassword = "Dorwssap"; } return this. generateSimple (basePassword); },
     
      generateSimple:function (base) {var pwd = base; var numbers = '0123456789'; var length = 4;
     
         for (var i  = 0 , n  = numbers. length ; i  < length ; i ++) {
            pwd += numbers.charAt (Math.floor (Math.random () * n) + 1); } return pwd;}, 
     
      type:'SamplePasswordGenerator'} ;

## '재설정 후' 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_z15_3dw_sbb}

{#pw-reset-ext-script-includes__section_z15_3dw_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 재설정 후 | 프로세스가 완료된 암호 재설정 후 추가 작업을 수행합니다. | 프로세스(매개변수) | 매개 변수: * params.resetRequestId - 호출 암호 재설정 프로세스의 sys_id입니다(테이블: pwd_process). * params.wfSuccess - 워크플로우가 성공적으로 완료되었는지 여부를 나타내는 플래그입니다. 성공한 경우에만 True입니다. {#pw-reset-ext-script-includes__ul_s3r_j5z_qp} | 반환: void |
[ ]

이 예제에서는 실패한 재설정 요청을 시스템 로그에 추가합니다. 이 코드는 PwdPostProcessor'라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var PwdPostProcessor = Class.create ();
     
    PwdPostProcessor. prototype = {
        category: 'password_reset.extension.post_reset_script', // DO NOT REMOVE THIS LINE!
     
        initialize:function () { },
     
         /**********
         * Execute custom actions after the 암호 재설정 process has completed.
        * 
        * @param params.resetRequestId The sys_id of the current 암호 재설정 request (table: pwd_reset_request)
        * @param params.wfSuccess      A flag indicating if the workflow completed sucessfully. 
        *  True if (and only if) successful.
        * @return no return value
        **********/
        process: function (params) {if (!params. wfSuccess) {
               now_GS.log ('[PwdPostProcessor.process] failure post processing for request [' + params. resetRequestId + ']'); }
     
             // We could place actions here that we always want executed return; },
     
        type:'PwdPostProcessor' }

## "사용자 계정 조회" 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_sdd_22w_sbb}

{#pw-reset-ext-script-includes__section_sdd_22w_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 사용자 계정 조회 | 지정된 사용자의 자격 증명 스토어 계정 ID를 가져옵니다. | 프로세스(매개변수) | 매개변수:params.userId - 검사 중인 사용자의 sys_id입니다(테이블: sys_user). | 반환: (문자열) 지정된 사용자의 자격 증명 스토어 계정 ID입니다. |
[ ]

이 예제에서는 사용자의 자격 증명 스토어 계정을 가져옵니다. 이 코드는 SampleUserAccountLookupExtension이라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var SampleUserAccountLookupExtension = Class.create ();
    SampleUserAccountLookupExtension. prototype = {
      category:'password_reset.extension.user_account_lookup', // DO NOT REMOVE THIS LINE!
     
       /**********
      * Returns the credential store account id for a given user.
      * This sample echoes the user_id supplied as the credential store account id for that user.
      * 
      * @param params.userId  The sys_id of the user being checked (table: sys_user)
      * @return               The credential store account id (string) for a given user
      **********/
      process:function (params) {return params.userId;},
     
      type:'SampleUserAccountLookupExtension' }

## '검증 양식 프로세서' 스크립트 포함 범주 {#pw-reset-ext-script-includes__section_w3y_22w_sbb}

{#pw-reset-ext-script-includes__section_w3y_22w_sbb__entry__5}

| 스크립트 포함 범주 | 설명 | 메서드 서명 | 입력 필드 | 출력 필드 |
|-|-|-|-|-|
| 검증 양식 프로세서 | 검증 양식 요청을 처리하고 사용자가 검증되었는지 여부를 표시합니다. | processForm(매개변수, 요청) | 매개 변수: * params.resetRequestId - 현재 암호 재설정 요청의 sys_id입니다(테이블: pwd_reset_request). * params.userId - 검증할 사용자의 sys_id입니다(테이블: sys_user). * params.verificationId - 처리할 검증의 sys_id입니다(테이블: pwd_verification). * request - 양식 요청 객체입니다. 양식의 필드는 request.getParameter('\<element-id\>')를 사용하여 액세스할 수 있습니다. {#pw-reset-ext-script-includes__ul_tzr_z5z_qp} | 반환: (부울) 사용자가 확인된 경우 true입니다. 그렇지 않으면 false입니다. |
[ ]

이 예제에서는 사용자가 입력 필드에 ok 를 보낸 경우에만 true를 반환하는 확인 프로세서를 보여 줍니다. 그렇지 않으면 false를 반환합니다. 이 코드는 SampleVerificationFormProcessor라는 확장 스크립트의 스크립트 필드에 포함됩니다.

    var SampleVerificationFormProcessor = Class.create ();
    SampleVerificationFormProcessor.prototype = {
      category:'password_reset.extension.verification_form_processor', // DO NOT REMOVE THIS LINE!
     
       /**********
       * Process the verification form request, and return whether the user was successfully verified.
       * This is a sample verification processor returns true only if the user sent "ok" in the input field; 
       * otherwise, it returns false.
       * 
       * @param params.resetRequestId The sys_id of the current 암호 재설정 request (table: pwd_reset_request)
       * @param params.userId         The sys_id of the user trying to be verified (table: sys_user)
       * @param params.verificationId The sys_id of the verification to be processed (table: pwd_verification)
       * @param request               The form request object. Fields in the form can be accessed with
       * request.getParameter('<element-id>')
       * @return Boolean indicating whether the user is successfully verified
       **********/
      processForm:function (params, request) {if (request.getParameter ("sysparm_simple_input") == "ok") return true; else return false; },
     
      type:'SampleVerificationFormProcessor'};

**관련 정보**   

* [확장점](https://www.servicenow.com/docs/access?context=extension-points&version=xanadu&pubname=xanadu-api-reference&ft:locale=en-US)

