Skip to content

Commit

Permalink
upgrade to v3 (#16)
Browse files Browse the repository at this point in the history
* upgrade to v3
EItanya authored Nov 23, 2020
1 parent 33a3e6a commit cb8ed58
Showing 4 changed files with 29 additions and 17 deletions.
30 changes: 15 additions & 15 deletions api/interface.go
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@ package api
import (
"context"

envoyauthv2 "github.com/envoyproxy/go-control-plane/envoy/service/auth/v2"
envoytype "github.com/envoyproxy/go-control-plane/envoy/type"
envoy_service_auth_v3 "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
envoy_type_v3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
"google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes"
)
@@ -17,12 +17,12 @@ type AuthorizationResponse struct {
// Additional user information
UserInfo UserInfo
// The result of the authorization process that will be sent back to Envoy
CheckResponse envoyauthv2.CheckResponse
CheckResponse envoy_service_auth_v3.CheckResponse
}

type AuthorizationRequest struct {
// The request that needs to be authorized
CheckRequest *envoyauthv2.CheckRequest
CheckRequest *envoy_service_auth_v3.CheckRequest
State map[string]interface{}
}

@@ -108,7 +108,7 @@ type ExtAuthPlugin interface {
// Minimal OK response
func AuthorizedResponse() *AuthorizationResponse {
return &AuthorizationResponse{
CheckResponse: envoyauthv2.CheckResponse{
CheckResponse: envoy_service_auth_v3.CheckResponse{
Status: &status.Status{
Code: int32(codes.OK),
},
@@ -119,7 +119,7 @@ func AuthorizedResponse() *AuthorizationResponse {
// Minimal FORBIDDEN (403) response
func UnauthorizedResponse() *AuthorizationResponse {
return &AuthorizationResponse{
CheckResponse: envoyauthv2.CheckResponse{
CheckResponse: envoy_service_auth_v3.CheckResponse{
Status: &status.Status{
Code: int32(codes.PermissionDenied),
},
@@ -130,14 +130,14 @@ func UnauthorizedResponse() *AuthorizationResponse {
// Minimal UNAUTHORIZED (401) response
func UnauthenticatedResponse() *AuthorizationResponse {
return &AuthorizationResponse{
CheckResponse: envoyauthv2.CheckResponse{
CheckResponse: envoy_service_auth_v3.CheckResponse{
Status: &status.Status{
Code: int32(codes.Unauthenticated),
},
HttpResponse: &envoyauthv2.CheckResponse_DeniedResponse{
DeniedResponse: &envoyauthv2.DeniedHttpResponse{
Status: &envoytype.HttpStatus{
Code: envoytype.StatusCode_Unauthorized,
HttpResponse: &envoy_service_auth_v3.CheckResponse_DeniedResponse{
DeniedResponse: &envoy_service_auth_v3.DeniedHttpResponse{
Status: &envoy_type_v3.HttpStatus{
Code: envoy_type_v3.StatusCode_Unauthorized,
},
},
},
@@ -147,10 +147,10 @@ func UnauthenticatedResponse() *AuthorizationResponse {

func InternalServerErrorResponse() *AuthorizationResponse {
resp := UnauthorizedResponse()
resp.CheckResponse.HttpResponse = &envoyauthv2.CheckResponse_DeniedResponse{
DeniedResponse: &envoyauthv2.DeniedHttpResponse{
Status: &envoytype.HttpStatus{
Code: envoytype.StatusCode_InternalServerError,
resp.CheckResponse.HttpResponse = &envoy_service_auth_v3.CheckResponse_DeniedResponse{
DeniedResponse: &envoy_service_auth_v3.DeniedHttpResponse{
Status: &envoy_type_v3.HttpStatus{
Code: envoy_type_v3.StatusCode_InternalServerError,
},
},
}
6 changes: 6 additions & 0 deletions changelog/v0.2.0/envoy-v3-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: BREAKING_CHANGE
description: Update ext-auth plugin interface to envoy V3 APIs.
issueLink: https://github.com/solo-io/gloo/issues/2815
resolvesIssue: false

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ module github.com/solo-io/ext-auth-plugins
go 1.13

require (
github.com/envoyproxy/go-control-plane v0.9.0
github.com/envoyproxy/go-control-plane v0.9.5
github.com/envoyproxy/protoc-gen-validate v0.1.0
github.com/golang/protobuf v1.3.2
github.com/hpcloud/tail v1.0.1-0.20180514194441-a1dbeea552b7
@@ -13,7 +13,7 @@ require (
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
golang.org/x/text v0.3.0
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
google.golang.org/grpc v1.23.0
google.golang.org/grpc v1.25.1
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
gopkg.in/yaml.v2 v2.2.1
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -2,8 +2,12 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533 h1:8wZizuKuZVu5COB7EsBYxBQz8nRcXXn5d4Gt91eJLvU=
github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/envoyproxy/go-control-plane v0.9.0 h1:67WMNTvGrl7V1dWdKCeTwxDr7nio9clKoTlLhwIPnT4=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.5 h1:lRJIqDD8yjV1YyPRqecMdytjDLs2fTXq363aCib5xPU=
github.com/envoyproxy/go-control-plane v0.9.5/go.mod h1:OXl5to++W0ctG+EHWTFUjiypVxC/Y4VLc/KFU+al13s=
github.com/envoyproxy/protoc-gen-validate v0.0.15-0.20190610174345-9b492f1473af/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
@@ -60,6 +64,8 @@ google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmE
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 h1:XNNYLJHt73EyYiCZi6+xjupS9CpvmiDgjPTAjrBlQbo=

0 comments on commit cb8ed58

Please sign in to comment.