-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: Set security headers to protect against ClickJacking and XSS
Added: Readme.md
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
 | ||
|
||
# ginSwagger | ||
|
||
provides a safe way to server the SwaggerUI | ||
|
||
## Reason for implementation | ||
Reason to provide this package is that the https://github.com/swaggo/gin-swagger is actually not using the latest swagger-ui. | ||
|
||
To use the latest swagger-ui (by using github.com/swaggo/files/v2) we needed to change the implementation as the gin-swagger package sitll uses the files in version 1.0 | ||
|
||
## Sources used | ||
To compile the new package we took the gin-echo package (https://github.com/swaggo/echo-swagger/blob/master/swagger.go) as a reference and added the gin based functionality. | ||
|
||
|
||
## Usage | ||
|
||
If you need the possibility to authenticate using keycloak you first need to set the OAuthConfig. | ||
Then provide this OAuthConfig to the ginSwagger.GinWrapHandler which serves the swagger UI. | ||
|
||
Example | ||
```go | ||
authConfig := &ginSwagger.OAuthConfig{ | ||
ClientId: cfg.WebClientName, | ||
Realm: cfg.Realm, | ||
AppName: "Asset Management Backend", | ||
} | ||
|
||
ginSwagger.GinWrapHandler( | ||
ginSwagger.OAuth(authConfig), | ||
ginSwagger.InstanceName(""), | ||
)(c) | ||
``` | ||
|
||
# License | ||
|
||
Copyright (C) 2022-2023 [Greenbone AG][Greenbone AG] | ||
|
||
Licensed under the [GNU General Public License v3.0 or later](../../LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters