// Interceptor creates a grpc auth interceptor
Interceptor creates a grpc auth interceptor
// Interceptor creates a grpc auth interceptor
func Inteceptor(publicKeyFile string) (grpc.UnaryServerInterceptor, error) {
	f, err := os.Open(publicKeyFile)
	if err != nil {
		return nil, fmt.Errorf("cannot open public key file: %v", err)
	}
	b, err := ioutil.ReadAll(f)
	if err != nil {
		return nil, fmt.Errorf("cannot read public key: %v", err)
	}
	pubKey, err := jwt.ParseRSAPublicKeyFromPEM(b)
	if err != nil {
		return nil, fmt.Errorf("cannot parse public key: %v", err)
	}
	i := &interceptor{
		verifier: &token.JWTTokenVerifier{
			PublicKey: pubKey,
		},
	}
	return i.HandlerReq, nil
}
func Inteceptor ( publicKeyFile string ) ( grpc . UnaryServerInterceptor , error ) { f , err := os . Open ( publicKeyFile ) if err != nil { return nil , fmt . Errorf ( " " , err ) } b , err := ioutil . ReadAll ( f ) if err != nil { return nil , fmt . Errorf ( " " , err ) } pubKey , err := jwt . ParseRSAPublicKeyFromPEM ( b ) if err != nil { return nil , fmt . Errorf ( " " , err ) } i := & interceptor { verifier : & token . JWTTokenVerifier { PublicKey : pubKey , } , } return i . HandlerReq , nil }
Interceptor creates a grpc auth interceptor
Interceptor creates a grpc auth interceptor