mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-27 13:10:13 +00:00
feat: add protoc pkg
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Code generated by protoc-gen-authmethod. DO NOT EDIT.
|
||||
|
||||
package {{.File.GoPkg.Name}}
|
||||
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
utils_auth "github.com/caos/zitadel/internal/auth"
|
||||
utils_grpc "github.com/caos/zitadel/internal/grpc"
|
||||
)
|
||||
|
||||
{{ range $s := .File.Services }}
|
||||
|
||||
/**
|
||||
* {{$s.Name}}
|
||||
*/
|
||||
|
||||
var {{$s.Name}}_AuthMethods = utils_auth.AuthMethodMapping {
|
||||
{{ range $m := $s.Method}}
|
||||
{{ $mAuthOpt := option $m.Options "caos.zitadel.utils.v1.auth_option" }}
|
||||
{{ if and $mAuthOpt $mAuthOpt.Permission }}
|
||||
"/{{$.File.Package}}.{{$s.Name}}/{{.Name}}": utils_auth.AuthOption{
|
||||
Permission: "{{$mAuthOpt.Permission}}",
|
||||
CheckParam: "{{$mAuthOpt.CheckFieldName}}",
|
||||
},
|
||||
{{end}}
|
||||
{{ end}}
|
||||
}
|
||||
|
||||
func {{$s.Name}}_Authorization_Interceptor(verifier utils_auth.TokenVerifier, authConf *utils_auth.AuthConfig) grpc.UnaryServerInterceptor {
|
||||
return utils_grpc.AuthorizationInterceptor(verifier, authConf, {{$s.Name}}_AuthMethods)
|
||||
}
|
||||
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user