oauth/oidc在openapi3中使用micronaut-swagger

mzillmmw  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(241)

我正在尝试使用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 {}


这是当前屏幕,如何Mapclient\u id和client\u secret,并且client\u secret应该是隐藏的,并且没有Map作用域。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题