Skip to content

Add Suppot for Hiding org.springframework.security.core.Authentication on ServerHttpResponse #423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
frankruegamer opened this issue Feb 13, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@frankruegamer
Copy link

frankruegamer commented Feb 13, 2020

I noticed this issue #245, but the Authentication definition still seems to be visible in the schema.
org.springframework.http.server.reactive.ServerHttpResponse on the other hand is hidden as expected.

Using springdoc v1.2.30. (Webflux)

@bnasslahsen bnasslahsen changed the title Hide org.springframework.security.core.Authentication Add Suppot for Hiding org.springframework.security.core.Authentication on ServerHttpResponse Feb 15, 2020
@bnasslahsen
Copy link
Collaborator

The support will be available on v 1.2.31.

@frankruegamer
Copy link
Author

After updating to 1.2.31 the Authentication object is still exported. Using the following method:

@PostMapping
public LoginResult login(Authentication authentication, ServerHttpResponse response) {
}

the following will be generated:

Authentication:
      type: object
      properties:
        principal:
          type: object
        credentials:
          type: object
        authorities:
          type: array
          items:
            $ref: '#/components/schemas/GrantedAuthority'
        authenticated:
          type: boolean
        details:
          type: object
        name:
          type: string
    GrantedAuthority:
      type: object
      properties:
        authority:
          type: string

Please let me know if you can't reproduce this issue as I'm happy to create a minimal project showcasing it.

@bnasslahsen
Copy link
Collaborator

Yes please, add the sample project to reproduce.

@frankruegamer
Copy link
Author

https://github.com/frankruegamer/sprindoc-authentication-bug

Note that the schema looks exactly like the one above.

@bnasslahsen
Copy link
Collaborator

bnasslahsen commented Feb 19, 2020

You are just missing the following dependency on your project:

<dependency>
	<groupId>org.springdoc</groupId>
	<artifactId>springdoc-openapi-security</artifactId>
	<version>1.2.31</version>
</dependency>

You can have a look at the documentation; (Section Spring security support)

@frankruegamer
Copy link
Author

Ah I didn't know this existed :) Works perfectly!

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants