2020-03-23 11:53:12 +01:00
|
|
|
// Code generated by protoc-gen-authmethod. DO NOT EDIT.
|
|
|
|
|
|
|
|
package {{.File.GoPkg.Name}}
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
2020-03-23 16:56:02 +01:00
|
|
|
utils_auth "github.com/caos/zitadel/internal/api/auth"
|
2020-03-25 10:54:45 +01:00
|
|
|
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
|
2020-03-23 11:53:12 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
{{ range $s := .File.Services }}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {{$s.Name}}
|
|
|
|
*/
|
|
|
|
|
2020-03-23 16:56:02 +01:00
|
|
|
var {{$s.Name}}_AuthMethods = utils_auth.MethodMapping {
|
2020-03-23 11:53:12 +01:00
|
|
|
{{ range $m := $s.Method}}
|
|
|
|
{{ $mAuthOpt := option $m.Options "caos.zitadel.utils.v1.auth_option" }}
|
|
|
|
{{ if and $mAuthOpt $mAuthOpt.Permission }}
|
2020-03-23 16:56:02 +01:00
|
|
|
"/{{$.File.Package}}.{{$s.Name}}/{{.Name}}": utils_auth.Option{
|
2020-03-23 11:53:12 +01:00
|
|
|
Permission: "{{$mAuthOpt.Permission}}",
|
|
|
|
CheckParam: "{{$mAuthOpt.CheckFieldName}}",
|
|
|
|
},
|
|
|
|
{{end}}
|
|
|
|
{{ end}}
|
|
|
|
}
|
|
|
|
|
2020-03-23 16:56:02 +01:00
|
|
|
func {{$s.Name}}_Authorization_Interceptor(verifier utils_auth.TokenVerifier, authConf *utils_auth.Config) grpc.UnaryServerInterceptor {
|
2020-03-25 10:54:45 +01:00
|
|
|
return middleware.AuthorizationInterceptor(verifier, authConf, {{$s.Name}}_AuthMethods)
|
2020-03-23 11:53:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{{ end }}
|