OAuth/OIDC in open api 3 with Micronaut swagger

500 Views Asked by At

I am trying to Authorize the API endpoint with identity OKTA from the Micronaut swagger definition.

Below is the configuration for the 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

For the security schema, what needs to be configured for the swagger to work with 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 {}

enter image description here

This is the current screen, how can I mapped the client_id and client_secret, and the client_secret should be hidden also the scopes are not mapped.

0

There are 0 best solutions below