mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-19 05:19:35 +00:00
In order to remove dependencies on `Sirupsen/logrus` while emicklei/go-restful-openapi/pull/49 is getting reviewed and, hopefully, merged: ``` $ gvt delete github.com/emicklei/go-restful-openapi $ gvt fetch --branch lowercase-sirupsen --revision 129557de7d9f2d2ca4a90cd31c379db90a561ad8 github.com/marccarre/go-restful-openapi 2018/07/23 15:50:36 Fetching: github.com/marccarre/go-restful-openapi 2018/07/23 15:50:38 · Skipping (existing): github.com/emicklei/go-restful 2018/07/23 15:50:38 · Skipping (existing): github.com/sirupsen/logrus 2018/07/23 15:50:38 · Skipping (existing): github.com/go-openapi/spec 2018/07/23 15:50:38 · Fetching recursive dependency: github.com/emicklei/go-restful-openapi 2018/07/23 15:50:40 ·· Skipping (existing): github.com/emicklei/go-restful 2018/07/23 15:50:40 ·· Fetching recursive dependency: github.com/Sirupsen/logrus 2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/sys/unix 2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/crypto/ssh/terminal 2018/07/23 15:50:43 ··· Skipping (existing): github.com/sirupsen/logrus 2018/07/23 15:50:43 ·· Skipping (existing): github.com/go-openapi/spec ```
28 lines
463 B
Go
28 lines
463 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
const (
|
|
SecurityDefinitionKey = "OAPI_SECURITY_DEFINITION"
|
|
)
|
|
|
|
type OAISecurity struct {
|
|
Name string // SecurityDefinition name
|
|
Scopes []string // Scopes for oauth2
|
|
}
|
|
|
|
func (s *OAISecurity) Valid() error {
|
|
switch s.Name {
|
|
case "oauth2":
|
|
return nil
|
|
case "openIdConnect":
|
|
return nil
|
|
default:
|
|
if len(s.Scopes) > 0 {
|
|
return fmt.Errorf("oai Security scopes for scheme '%s' should be empty", s.Name)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|