swagger swashbukle을 사용하여 API 문서를 구현했습니다. 이제 생성 된 문서를 내 웹 사이트의 도움말 파일로 게시하려고합니다. 이 링크를 보호하고 게시하는 방법?swagger swashbuckle을 사용하여 생성 된 API 문서를 보호하는 방법
2
A
답변
1
나는 지금까지 swagger swashbuckle 엔드 포인트를 확보 할 방법이 없다고 생각합니다. github 문제로 팁과 기타 사항을 얻을 수 있습니다. here
1
이 솔루션은 솔루션에 인증을 구현 한 경우에만 작동합니다.
- 는
- 새로운 Web.config 파일을 추가 솔루션에 새 폴더 자신감을 만듭니다. 거기에 코드를 다음
쓰기 :
<configuration> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>
1
나는이 작업을 수행하는 방법을 알아 냈어. 최신 swashbuckle 버전을 사용하여이 인증을 위해 한번 사용될 수 자신감의 UI에서 인증 단추를 보여줄 것이다>
주입
<div
ID 된 index.html = 'auth_container'에서 DIV 태그 아래에 추가 당신의 SwaggerConfig.cs 내부 https://github.com/domaindrivendev/Swashbuckle/issues/601
0
을 - 인증, API에 대한 모든 요청 들어, JWT 토큰이
또한 자신감의 UI에서 통과 될 것이라고 자신감의 문서에 대한 모든 호출을 보호하기 위해 아래 링크를 따라 파일을 만족 시키려면 다음 코드를 주석 해제하십시오. 보안 요구.
// You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the
// See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details.
// NOTE: These only define the schemes and need to be coupled with a corresponding "security" property
// at the document or operation level to indicate which schemes are required for an operation. To do this,
// you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties
// according to your specific authorization implementation
//
c.BasicAuth("basic")
.Description("Basic HTTP Authentication");
//
// NOTE: You must also configure 'EnableApiKeySupport' below in the SwaggerUI section
//c.ApiKey("apiKey")
// .Description("API Key Authentication")
// .Name("apiKey")
// .In("header");
//
//c.OAuth2("oauth2")
// .Description("OAuth2 Implicit Grant")
// .Flow("implicit")
// .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog")
// //.TokenUrl("https://tempuri.org/token")
// .Scopes(scopes =>
// {
// scopes.Add("read", "Read access to protected resources");
// scopes.Add("write", "Write access to protected resources");
// });
관련 문제
- 1. 경로 당 하나의 Swagger 스키마를 생성하도록 Swashbuckle을 얻으려면 어떻게해야합니까?
- 2. swagger를 사용하여 node.js API 문서를 생성하는 방법
- 3. Swagger 문서를 사용하여 웹 사이트에 API 문서 추가
- 4. Swagger API 문서를 Atlassian Confluence에 프로그래밍 방식으로 게시하는 방법?
- 5. Swagger API 목록 수정
- 6. 공식 Swagger API 스키마를 사용하여 Swagger API 선언 유효성 검사
- 7. Swashbuckle에 Swagger 파일 추가
- 8. Swagger 클라이언트 생성
- 9. Swashbuckle을 사용하여 빈 배열을 받아들이도록 Swagger UI를 구성 할 수 있습니까?
- 10. web-api & swagger documentation
- 11. Swagger 및 WebAPI (Swashbuckle) -/swagger 엔드 포인트를 비공개로 설정 하시겠습니까?
- 12. Swagger API 설명서
- 13. 필터로 인해 Swagger API 문서를 읽을 수 없습니다.
- 14. 앱에서 개인 문서를 최대로 보호하는 방법
- 15. Open XML을 사용하여 Excel 문서를 암호로 보호하는 방법
- 16. worknik 용 api 목록을 swagger
- 17. 생성 된 Swagger를 필터링하는 방법
- 18. ASP Net Core에서 URL을 보호하는 방법
- 19. swagger 또는 api first
- 20. Swagger 용 api-doc 작성하기
- 21. Azure에서 Swagger UI를 사용하는 방법 Easy API
- 22. Apache karaf를 사용하여 여러 OSGI 번들에서 Swagger API
- 23. OpenXml SDK를 사용하여 VbaProjectPart를 암호로 보호하는 방법
- 24. Dropwizard에 통합 된 Swagger
- 25. 비표준 Java 기술에 대한 Swagger API 통합
- 26. 원격 호출시 API 키를 도난으로부터 보호하는 방법
- 27. Nodejs/apidocjs : 템플릿없이 특정 URL에 생성 된 문서를 렌더링하는 방법
- 28. 중첩 된 리소스에 대해 레일 및 스가거 문서를 사용하여 API 메소드를 만드는 방법
- 29. Swagger - codegen에 의해 생성 된 단일 클래스 사용자 정의
- 30. 휴대 기기 : API 자격증 명을 보호하는 방법?
문제의 링크 주셔서 감사합니다. 주어진 솔루션 아래 나를 위해 작동합니다. https://github.com/domaindrivendev/Swashbuckle/issues/384#issuecomment-111609097 –