/
role.vdl.go
170 lines (145 loc) · 5.84 KB
/
role.vdl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Package: role
// Package role defines an interface for requesting blessings from a role
// account server.
package role
import (
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
"v.io/v23/security"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Const definitions
// Role.SeekBlessings will return an error if the requestor does not present
// blessings that end in this suffix.
const RoleSuffix = "_role"
//////////////////////////////////////////////////
// Interface definitions
// RoleClientMethods is the client interface
// containing Role methods.
//
// Role is an interface to request blessings from a role account server. The
// returned blessings are bound to the client's public key thereby authorizing
// the client to acquire the role. The server may tie the returned blessings
// with the client's presented blessing name in order to maintain audit
// information in the blessing.
//
// In order to avoid granting role blessings to all delegates of a principal,
// the role server requires that each authorized blessing presented by the
// client have the string "_role" as suffix.
type RoleClientMethods interface {
SeekBlessings(*context.T, ...rpc.CallOpt) (security.Blessings, error)
}
// RoleClientStub adds universal methods to RoleClientMethods.
type RoleClientStub interface {
RoleClientMethods
rpc.UniversalServiceMethods
}
// RoleClient returns a client stub for Role.
func RoleClient(name string) RoleClientStub {
return implRoleClientStub{name}
}
type implRoleClientStub struct {
name string
}
func (c implRoleClientStub) SeekBlessings(ctx *context.T, opts ...rpc.CallOpt) (o0 security.Blessings, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "SeekBlessings", nil, []interface{}{&o0}, opts...)
return
}
// RoleServerMethods is the interface a server writer
// implements for Role.
//
// Role is an interface to request blessings from a role account server. The
// returned blessings are bound to the client's public key thereby authorizing
// the client to acquire the role. The server may tie the returned blessings
// with the client's presented blessing name in order to maintain audit
// information in the blessing.
//
// In order to avoid granting role blessings to all delegates of a principal,
// the role server requires that each authorized blessing presented by the
// client have the string "_role" as suffix.
type RoleServerMethods interface {
SeekBlessings(*context.T, rpc.ServerCall) (security.Blessings, error)
}
// RoleServerStubMethods is the server interface containing
// Role methods, as expected by rpc.Server.
// There is no difference between this interface and RoleServerMethods
// since there are no streaming methods.
type RoleServerStubMethods RoleServerMethods
// RoleServerStub adds universal methods to RoleServerStubMethods.
type RoleServerStub interface {
RoleServerStubMethods
// Describe the Role interfaces.
Describe__() []rpc.InterfaceDesc
}
// RoleServer returns a server stub for Role.
// It converts an implementation of RoleServerMethods into
// an object that may be used by rpc.Server.
func RoleServer(impl RoleServerMethods) RoleServerStub {
stub := implRoleServerStub{
impl: impl,
}
// Initialize GlobState; always check the stub itself first, to handle the
// case where the user has the Glob method defined in their VDL source.
if gs := rpc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := rpc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implRoleServerStub struct {
impl RoleServerMethods
gs *rpc.GlobState
}
func (s implRoleServerStub) SeekBlessings(ctx *context.T, call rpc.ServerCall) (security.Blessings, error) {
return s.impl.SeekBlessings(ctx, call)
}
func (s implRoleServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implRoleServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{RoleDesc}
}
// RoleDesc describes the Role interface.
var RoleDesc rpc.InterfaceDesc = descRole
// descRole hides the desc to keep godoc clean.
var descRole = rpc.InterfaceDesc{
Name: "Role",
PkgPath: "v.io/x/ref/services/role",
Doc: "// Role is an interface to request blessings from a role account server. The\n// returned blessings are bound to the client's public key thereby authorizing\n// the client to acquire the role. The server may tie the returned blessings\n// with the client's presented blessing name in order to maintain audit\n// information in the blessing.\n//\n// In order to avoid granting role blessings to all delegates of a principal,\n// the role server requires that each authorized blessing presented by the\n// client have the string \"_role\" as suffix.",
Methods: []rpc.MethodDesc{
{
Name: "SeekBlessings",
OutArgs: []rpc.ArgDesc{
{"", ``}, // security.Blessings
},
},
},
}
var __VDLInitCalled bool
// __VDLInit performs vdl initialization. It is safe to call multiple times.
// If you have an init ordering issue, just insert the following line verbatim
// into your source files in this package, right after the "package foo" clause:
//
// var _ = __VDLInit()
//
// The purpose of this function is to ensure that vdl initialization occurs in
// the right order, and very early in the init sequence. In particular, vdl
// registration and package variable initialization needs to occur before
// functions like vdl.TypeOf will work properly.
//
// This function returns a dummy value, so that it can be used to initialize the
// first var in the file, to take advantage of Go's defined init order.
func __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
__VDLInitCalled = true
return struct{}{}
}