1

我正在尝试使用 Micronaut swagger 定义中的身份 OKTA 授权 API 端点。

下面是 OKTA 的配置

micronaut:
  application:
    name: demo
  security:
    authentication: idtoken
    oauth2:
      clients:
        okta:
          client-secret: '${OAUTH_CLIENT_SECRET}'
          client-id: '${OAUTH_CLIENT_ID}'
          openid:
            issuer: '${OIDC_ISSUER_DOMAIN}/oauth2/${OIDC_ISSUER_AUTHSERVERID}'
      endpoints:
        logout:
          get-allowed: true

对于安全模式,需要为 swagger 配置什么才能与 OKTA 一起使用。

@SecurityScheme(name = "Open Id Connect",
        type = SecuritySchemeType.OAUTH2,
        scheme = "bearer",
        bearerFormat = "jwt",
        flows = @OAuthFlows(
                authorizationCode = @OAuthFlow(
                        authorizationUrl = "https://dev-6271510.okta.com/oauth2/default",
                        tokenUrl = "https://dev-6271510.okta.com/oauth2/default/v1/token",
                        refreshUrl = "",
                        scopes = {@OAuthScope(name = "openid"),
                                @OAuthScope(name = "profile"),
                                @OAuthScope(name = "email"),
                                @OAuthScope(name = "address"),
                                @OAuthScope(name = "phone"),
                                @OAuthScope(name = "offline_access")
                        }))
)
public class Application {}

在此处输入图像描述

这是当前屏幕,我如何映射client_idclient_secret,并且client_secret应该隐藏,范围也没有映射。

4

0 回答 0