インストレーションイグジット

  • リリースバージョン: Washingtondc
  • 更新日 2024年02月01日
  • 読む6読むのに数分
  • インストレーションイグジットは、Java からイグジットしてスクリプトを呼び出してから Java に戻るカスタマイズ機能です。

    注:
    ここで説明する機能には、admin ロールが必要です。

    利用可能なインストレーションイグジット

    移動先 システム定義 > インストレーションイグジット. 一部のインストレーションイグジット名 (Login、Logout、ValidatePassword、ExternalAuthentication) は予約されており、変更できません。他のインストレーションイグジットは、デフォルトのインストレーションイグジットのスクリプトを置き換えるカスタムスクリプトで上書きすることができます。

    ベースシステムでは、次のインストレーションイグジットを使用できます。

    インストレーションイグジット 説明
    ログイン ユーザー名とパスワードのペアを取得し、ユーザーオブジェクトで認証します。
    ログアウト サインアウト時にようこそページに移動します。LogoutRedirect で上書きすることができます。
    LogoutRedirect サインアウト時に指定された URL に移動します。
    ExternalAuthentication ヘッダー、パラメーター、または cookie を使用して認証します。DigestSingleSignOn と PGPSingleSignOn で上書きすることができます。
    DigestSingleSignOn ヘッダー、パラメーター、または cookie を使用して認証し、ダイジェスト暗号を復号化します。
    PGPSingleSignOn ヘッダー、パラメーター、または cookie を使用して認証し、PGP 暗号を復号化します。
    ValidatePassword Helsinki リリース以降、デフォルトでアクティブ化されます。それにより、顧客が独自のパスワード検証を定義できます。また、ValidatePasswordStronger で上書きできます。
    ValidatePasswordStronger パスワードは 8 文字以上で、数字、大文字、および小文字を含める必要があります。
    GetIntegrationSessionTimeout デフォルトの統合セッションのタイムアウト動作を実装します。

    ログインの変更

    ログインインストレーションイグジットを次のように変更すると、ユーザーがログインする時に、各ユーザーのセッションタイムアウト値が設定されます。この特定の例では、ユーザー名が admin の場合、セッションは 30 秒でタイムアウトに設定されます。

    gs.include("PrototypeServer");
     
    var Login = Class.create();
    Login.prototype = {
    	initialize : function() {
    	},
     
            process : function() {
              // the request is passed in as a global
              var userName = request.getParameter("user_name");
              var userPassword = request.getParameter("user_password");
     
              var authed = GlideUser.authenticate(userName, userPassword);
              if (authed) {
                 // ***********************************************************        
                 // customization - if the userName == admin, set the session
                 // timeout to be 30 seconds. You can implement your own  
                 // session timeout algorithm here by checking to see if a user
                 // belongs to a certain group or has a certain role.
                 // Values of setMaxInactiveInterval exceeding 1440 minutes are
                 // treated as one day (1440 minutes).
      
               if (userName == "admin") {
                   request.getSession().setMaxInactiveInterval(30);
                 }
                 // ************************************************************
                 return GlideUser.getUser(userName);
              }
     
              this.loginFailed();
     
              return "login.failed";
            },
     
            loginFailed : function() {
              var message = GlideSysMessage.format("login_invalid");
              var gSession = GlideSession.get();
              gSession.addErrorMessage(message);
     
              var userName = request.getParameter("user_name");
              EventManager.queue("login.failed", "", userName, "");
           }
     
    }

    セッションタイムアウトは、IP アドレスに基づいて設定することもできます。

    gs.include("PrototypeServer");
     
    var Login = Class.create();
    Login.prototype = {
    	initialize : function() {
    	},
     
            process : function() {
              // the request is passed in as a global
              var userName = request.getParameter("user_name");
              var userPassword = request.getParameter("user_password");
     
              var authed = GlideUser.authenticate(userName, userPassword);
              if (authed) {
     
              // **************************************************************
              // customization - if the user is logging in from a particular IP
              // range starting with XXX.XXX you can implement your own
              // session timeout algorithm here by checking the login IP
              // 
              // Values of setMaxInactiveInterval exceeding 1440 minutes are
              // treated as one day (1440 minutes).
     
              var clientIP = gs.getSession().getClientIP().toString();
    
              // if client IP starts with specified range
              if (clientIP.indexOf('XXX.XXX') == 0) {  
                 // set to 10 hours
                 request.getSession().setMaxInactiveInterval(60 * 60 * 10); 
              }
              // ***************************************************************
     
                 return GlideUser.getUser(userName);
              }
     
              this.loginFailed();
     
              return "login.failed";
            },
     
            loginFailed : function() {
              var message = GlideSysMessage.format("login_invalid");
              var gSession = GlideSession.get();
              gSession.addErrorMessage(message);
     
              var userName = request.getParameter("user_name");
              EventManager.queue("login.failed", "", userName, "");
           }
     
    }