Hanzo
PlatformHanzo IAMIntegrationsPHP

Zentao

Using Hanzo IAM for authentication in Zentao

Zentao is an agile project management tool. It does not support OIDC natively; use the zentao-oidc module to integrate Hanzo IAM SSO.

Step 1: Deploy Hanzo IAM and Zentao

Deploy Hanzo IAM and Zentao. Ensure both are running and you can sign in to each.

Step 2: Integrate Zentao OIDC third-party module

Install zentao-oidc by running the following command:

git clone https://github.com/iam/zentao-oidc.git

Alternatively, download the ZIP and unzip it.

This module is used to integrate Zentao with SSO for OpenId. Here's how to use it:

1. Copy the entire `oidc` directory to the module of Zentao and use it as a module of Zentao.
   Rename the downloaded package to "oidc".

2. Configure the filter.

   Since the Zentao framework filters the parameters in the URL and does not allow spaces,
   add the following at the end of `/config/my.php`.

   ```php
   $filter->oidc = new stdclass();
   $filter->oidc->index = new stdclass();
   $filter->oidc->index->paramValue['scope'] = 'reg::any';
  1. Modify /module/commom/model.php. Add 'oidc' to the anonymous access list and add a line to the isOpenMethod method of model.php.
    public function isOpenMethod($module, $method)
    {          
        if ($module == 'oidc' and $method == 'index') {
            return true; 
        }
    }
  2. If you don't want the Zentao login screen to appear, go directly to the Hanzo IAM login screen. Modify the last line of code in public function checkPriv() in /module/common/model.php.
    //return print(js::locate(helper::createLink('user', 'login', "referer=$referer")));
    return print(js::locate(helper::createLink('oidc', 'index', "referer=$referer")));
  3. Modify the setSuperVars() method inside framework/base/router.class.php and comment out the following statements.
    public function setSuperVars()
    //  unset($_REQUEST);

Step 3: Configure Hanzo IAM Application

  1. Create a new Hanzo IAM application or use an existing one.
  2. Add your redirect URL. Hanzo IAM Application Setting
  3. Add the provider you want and fill in other required settings.

Step 4: Configure Zentao

Configure the config.php file in the oidc directory.

$config->oidc->clientId = "<Your ClientId>";
$config->oidc->clientSecret = "<Your ClientSecret>";
$config->oidc->issuer = "http://localhost:8000";

Set your redirect URL in `module/oidc` in the `public function index()` method.

```php
$oidc->setRedirectURL($path."/zentao/oidc-index.html");

:::note

The URL here refers to calling the 'index' method in the 'oidc' module. You also need to set a variable separator.
By default, the framework uses a dash ("-").
See the official Zentao framework docs for more details.
["zentaoPHP框架"](https://devel.easycorp.cn/book/zentaophphelp/about-10.html)

:::

How is this guide?

Last updated on

On this page