mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-07 06:16:18 +02:00
authenticate: unmarshal and verify state from jwt, instead of middleware authorize: embed opa policy using statik authorize: have IsAuthorized handle authorization for all routes authorize: if no signing key is provided, one is generated authorize: remove IsAdmin grpc endpoint authorize/client: return authorize decision struct cmd/pomerium: main logger no longer contains email and group cryptutil: add ECDSA signing methods dashboard: have impersonate form show up for all users, but have api gated by authz docs: fix typo in signed jwt header encoding/jws: remove unused es256 signer frontend: namespace static web assets internal/sessions: remove leeway to match authz policy proxy: move signing functionality to authz proxy: remove jwt attestation from proxy (authZ does now) proxy: remove non-signed headers from headers proxy: remove special handling of x-forwarded-host sessions: do not verify state in middleware sessions: remove leeway from state to match authz sessions/{all}: store jwt directly instead of state Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
372 lines
14 KiB
Go
372 lines
14 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: authorize.proto
|
|
|
|
package authorize
|
|
|
|
import (
|
|
context "context"
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
math "math"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
type IsAuthorizedRequest struct {
|
|
// User Context
|
|
//
|
|
UserToken string `protobuf:"bytes,1,opt,name=user_token,json=userToken,proto3" json:"user_token,omitempty"`
|
|
// Request Context
|
|
//
|
|
// Method specifies the HTTP method (GET, POST, PUT, etc.).
|
|
RequestMethod string `protobuf:"bytes,2,opt,name=request_method,json=requestMethod,proto3" json:"request_method,omitempty"`
|
|
// URL specifies either the URI being requested
|
|
RequestUrl string `protobuf:"bytes,3,opt,name=request_url,json=requestUrl,proto3" json:"request_url,omitempty"`
|
|
// host specifies the host on which the URL per RFC 7230, section 5.4
|
|
RequestHost string `protobuf:"bytes,4,opt,name=request_host,json=requestHost,proto3" json:"request_host,omitempty"`
|
|
// request_uri is the unmodified request-target of the
|
|
// Request-Line (RFC 7230, Section 3.1.1) as sent by the client
|
|
RequestRequestUri string `protobuf:"bytes,5,opt,name=request_request_uri,json=requestRequestUri,proto3" json:"request_request_uri,omitempty"`
|
|
// RemoteAddr allows HTTP servers and other software to record
|
|
// the network address that sent the request, usually for
|
|
RequestRemoteAddr string `protobuf:"bytes,6,opt,name=request_remote_addr,json=requestRemoteAddr,proto3" json:"request_remote_addr,omitempty"`
|
|
RequestHeaders map[string]*IsAuthorizedRequest_Headers `protobuf:"bytes,7,rep,name=request_headers,json=requestHeaders,proto3" json:"request_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) Reset() { *m = IsAuthorizedRequest{} }
|
|
func (m *IsAuthorizedRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*IsAuthorizedRequest) ProtoMessage() {}
|
|
func (*IsAuthorizedRequest) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_ffbc3c71370bee9a, []int{0}
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_IsAuthorizedRequest.Unmarshal(m, b)
|
|
}
|
|
func (m *IsAuthorizedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_IsAuthorizedRequest.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *IsAuthorizedRequest) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_IsAuthorizedRequest.Merge(m, src)
|
|
}
|
|
func (m *IsAuthorizedRequest) XXX_Size() int {
|
|
return xxx_messageInfo_IsAuthorizedRequest.Size(m)
|
|
}
|
|
func (m *IsAuthorizedRequest) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_IsAuthorizedRequest.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_IsAuthorizedRequest proto.InternalMessageInfo
|
|
|
|
func (m *IsAuthorizedRequest) GetUserToken() string {
|
|
if m != nil {
|
|
return m.UserToken
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestMethod() string {
|
|
if m != nil {
|
|
return m.RequestMethod
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestUrl() string {
|
|
if m != nil {
|
|
return m.RequestUrl
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestHost() string {
|
|
if m != nil {
|
|
return m.RequestHost
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestRequestUri() string {
|
|
if m != nil {
|
|
return m.RequestRequestUri
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestRemoteAddr() string {
|
|
if m != nil {
|
|
return m.RequestRemoteAddr
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest) GetRequestHeaders() map[string]*IsAuthorizedRequest_Headers {
|
|
if m != nil {
|
|
return m.RequestHeaders
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// headers represents key-value pairs in an HTTP header; map[string][]string
|
|
type IsAuthorizedRequest_Headers struct {
|
|
Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest_Headers) Reset() { *m = IsAuthorizedRequest_Headers{} }
|
|
func (m *IsAuthorizedRequest_Headers) String() string { return proto.CompactTextString(m) }
|
|
func (*IsAuthorizedRequest_Headers) ProtoMessage() {}
|
|
func (*IsAuthorizedRequest_Headers) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_ffbc3c71370bee9a, []int{0, 0}
|
|
}
|
|
|
|
func (m *IsAuthorizedRequest_Headers) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_IsAuthorizedRequest_Headers.Unmarshal(m, b)
|
|
}
|
|
func (m *IsAuthorizedRequest_Headers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_IsAuthorizedRequest_Headers.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *IsAuthorizedRequest_Headers) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_IsAuthorizedRequest_Headers.Merge(m, src)
|
|
}
|
|
func (m *IsAuthorizedRequest_Headers) XXX_Size() int {
|
|
return xxx_messageInfo_IsAuthorizedRequest_Headers.Size(m)
|
|
}
|
|
func (m *IsAuthorizedRequest_Headers) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_IsAuthorizedRequest_Headers.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_IsAuthorizedRequest_Headers proto.InternalMessageInfo
|
|
|
|
func (m *IsAuthorizedRequest_Headers) GetValue() []string {
|
|
if m != nil {
|
|
return m.Value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type IsAuthorizedReply struct {
|
|
Allow bool `protobuf:"varint,1,opt,name=allow,proto3" json:"allow,omitempty"`
|
|
SessionExpired bool `protobuf:"varint,2,opt,name=session_expired,json=sessionExpired,proto3" json:"session_expired,omitempty"`
|
|
DenyReasons []string `protobuf:"bytes,3,rep,name=deny_reasons,json=denyReasons,proto3" json:"deny_reasons,omitempty"`
|
|
SignedJwt string `protobuf:"bytes,4,opt,name=signed_jwt,json=signedJwt,proto3" json:"signed_jwt,omitempty"`
|
|
User string `protobuf:"bytes,5,opt,name=user,proto3" json:"user,omitempty"`
|
|
Email string `protobuf:"bytes,6,opt,name=email,proto3" json:"email,omitempty"`
|
|
Groups []string `protobuf:"bytes,7,rep,name=groups,proto3" json:"groups,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) Reset() { *m = IsAuthorizedReply{} }
|
|
func (m *IsAuthorizedReply) String() string { return proto.CompactTextString(m) }
|
|
func (*IsAuthorizedReply) ProtoMessage() {}
|
|
func (*IsAuthorizedReply) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_ffbc3c71370bee9a, []int{1}
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_IsAuthorizedReply.Unmarshal(m, b)
|
|
}
|
|
func (m *IsAuthorizedReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_IsAuthorizedReply.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *IsAuthorizedReply) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_IsAuthorizedReply.Merge(m, src)
|
|
}
|
|
func (m *IsAuthorizedReply) XXX_Size() int {
|
|
return xxx_messageInfo_IsAuthorizedReply.Size(m)
|
|
}
|
|
func (m *IsAuthorizedReply) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_IsAuthorizedReply.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_IsAuthorizedReply proto.InternalMessageInfo
|
|
|
|
func (m *IsAuthorizedReply) GetAllow() bool {
|
|
if m != nil {
|
|
return m.Allow
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetSessionExpired() bool {
|
|
if m != nil {
|
|
return m.SessionExpired
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetDenyReasons() []string {
|
|
if m != nil {
|
|
return m.DenyReasons
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetSignedJwt() string {
|
|
if m != nil {
|
|
return m.SignedJwt
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetUser() string {
|
|
if m != nil {
|
|
return m.User
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetEmail() string {
|
|
if m != nil {
|
|
return m.Email
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *IsAuthorizedReply) GetGroups() []string {
|
|
if m != nil {
|
|
return m.Groups
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterType((*IsAuthorizedRequest)(nil), "authorize.IsAuthorizedRequest")
|
|
proto.RegisterMapType((map[string]*IsAuthorizedRequest_Headers)(nil), "authorize.IsAuthorizedRequest.RequestHeadersEntry")
|
|
proto.RegisterType((*IsAuthorizedRequest_Headers)(nil), "authorize.IsAuthorizedRequest.Headers")
|
|
proto.RegisterType((*IsAuthorizedReply)(nil), "authorize.IsAuthorizedReply")
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterFile("authorize.proto", fileDescriptor_ffbc3c71370bee9a)
|
|
}
|
|
|
|
var fileDescriptor_ffbc3c71370bee9a = []byte{
|
|
// 431 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcf, 0x6e, 0x13, 0x31,
|
|
0x10, 0xc6, 0xd9, 0x6e, 0x9b, 0x76, 0x27, 0xa5, 0xa1, 0x13, 0x84, 0xac, 0x08, 0x68, 0x88, 0x04,
|
|
0xe4, 0x94, 0x43, 0xb8, 0x20, 0xc4, 0xa5, 0x87, 0x4a, 0x05, 0x09, 0x0e, 0x16, 0x9c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xf7, 0x2e, 0xf1,
|
|
0xe1, 0xbf, 0x27, 0x35, 0xb9, 0xff, 0xd7, 0xfd, 0x56, 0xf6, 0xb3, 0x5b, 0x9f, 0x06, 0xfe, 0x9f,
|
|
0x79, 0xf6, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x10, 0x59, 0xee, 0x46, 0x03, 0x00, 0x00,
|
|
}
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ context.Context
|
|
var _ grpc.ClientConnInterface
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
const _ = grpc.SupportPackageIsVersion6
|
|
|
|
// AuthorizerClient is the client API for Authorizer service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
type AuthorizerClient interface {
|
|
IsAuthorized(ctx context.Context, in *IsAuthorizedRequest, opts ...grpc.CallOption) (*IsAuthorizedReply, error)
|
|
}
|
|
|
|
type authorizerClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewAuthorizerClient(cc grpc.ClientConnInterface) AuthorizerClient {
|
|
return &authorizerClient{cc}
|
|
}
|
|
|
|
func (c *authorizerClient) IsAuthorized(ctx context.Context, in *IsAuthorizedRequest, opts ...grpc.CallOption) (*IsAuthorizedReply, error) {
|
|
out := new(IsAuthorizedReply)
|
|
err := c.cc.Invoke(ctx, "/authorize.Authorizer/IsAuthorized", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// AuthorizerServer is the server API for Authorizer service.
|
|
type AuthorizerServer interface {
|
|
IsAuthorized(context.Context, *IsAuthorizedRequest) (*IsAuthorizedReply, error)
|
|
}
|
|
|
|
// UnimplementedAuthorizerServer can be embedded to have forward compatible implementations.
|
|
type UnimplementedAuthorizerServer struct {
|
|
}
|
|
|
|
func (*UnimplementedAuthorizerServer) IsAuthorized(ctx context.Context, req *IsAuthorizedRequest) (*IsAuthorizedReply, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method IsAuthorized not implemented")
|
|
}
|
|
|
|
func RegisterAuthorizerServer(s *grpc.Server, srv AuthorizerServer) {
|
|
s.RegisterService(&_Authorizer_serviceDesc, srv)
|
|
}
|
|
|
|
func _Authorizer_IsAuthorized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(IsAuthorizedRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(AuthorizerServer).IsAuthorized(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/authorize.Authorizer/IsAuthorized",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(AuthorizerServer).IsAuthorized(ctx, req.(*IsAuthorizedRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
var _Authorizer_serviceDesc = grpc.ServiceDesc{
|
|
ServiceName: "authorize.Authorizer",
|
|
HandlerType: (*AuthorizerServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "IsAuthorized",
|
|
Handler: _Authorizer_IsAuthorized_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "authorize.proto",
|
|
}
|