2.4. Configuring the internal OAuth server’s token duration


You can configure default options for the internal OAuth server’s token duration.

重要

By default, tokens are only valid for 24 hours. Existing sessions expire after this time elapses.

If the default time is insufficient, then this can be modified using the following procedure.

Procedure

  1. Create a configuration file that contains the token duration options. The following file sets this to 48 hours, twice the default.

    apiVersion: config.openshift.io/v1
    kind: OAuth
    metadata:
      name: cluster
    spec:
      tokenConfig:
        accessTokenMaxAgeSeconds: 172800 1
    1
    Set accessTokenMaxAgeSeconds to control the lifetime of access tokens. The default lifetime is 24 hours, or 86400 seconds. This attribute cannot be negative. If set to zero, the default lifetime is used.
  2. Apply the new configuration file:

    注意

    Because you update the existing OAuth server, you must use the oc apply command to apply the change.

    $ oc apply -f </path/to/file.yaml>
  3. Confirm that the changes are in effect:

    $ oc describe oauth.config.openshift.io/cluster

    Example output

    ...
    Spec:
      Token Config:
        Access Token Max Age Seconds:  172800
    ...

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.