blob: 0bf7b7559e9b8c40782ff7afa41d20581f3c9c38 [file] [log] [blame]
// This file was auto-generated by the veyron vdl tool.
// Source: identity.vdl
// Package identity defines services for identity providers in the veyron ecosystem.
package identity
import (
"veyron.io/veyron/veyron2/security"
// The non-user imports are prefixed with "__" to prevent collisions.
__veyron2 "veyron.io/veyron/veyron2"
__context "veyron.io/veyron/veyron2/context"
__ipc "veyron.io/veyron/veyron2/ipc"
__vdlutil "veyron.io/veyron/veyron2/vdl/vdlutil"
__wiretype "veyron.io/veyron/veyron2/wiretype"
)
// TODO(toddw): Remove this line once the new signature support is done.
// It corrects a bug where __wiretype is unused in VDL pacakges where only
// bootstrap types are used on interfaces.
const _ = __wiretype.TypeIDInvalid
// OAuthBlesserClientMethods is the client interface
// containing OAuthBlesser methods.
//
// OAuthBlesser exchanges OAuth access tokens for
// an email address from an OAuth-based identity provider and uses the email
// address obtained to bless the client.
//
// OAuth is described in RFC 6749 (http://tools.ietf.org/html/rfc6749),
// though the Google implementation also has informative documentation at
// https://developers.google.com/accounts/docs/OAuth2
//
// WARNING: There is no binding between the channel over which the access token
// was obtained (typically https) and the channel used to make the RPC (a
// veyron virtual circuit).
// Thus, if Mallory possesses the access token associated with Alice's account,
// she may be able to obtain a blessing with Alice's name on it.
type OAuthBlesserClientMethods interface {
// BlessUsingAccessToken uses the provided access token to obtain the email
// address and returns a blessing along with the email address.
BlessUsingAccessToken(ctx __context.T, token string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, email string, err error)
}
// OAuthBlesserClientStub adds universal methods to OAuthBlesserClientMethods.
type OAuthBlesserClientStub interface {
OAuthBlesserClientMethods
__ipc.UniversalServiceMethods
}
// OAuthBlesserClient returns a client stub for OAuthBlesser.
func OAuthBlesserClient(name string, opts ...__ipc.BindOpt) OAuthBlesserClientStub {
var client __ipc.Client
for _, opt := range opts {
if clientOpt, ok := opt.(__ipc.Client); ok {
client = clientOpt
}
}
return implOAuthBlesserClientStub{name, client}
}
type implOAuthBlesserClientStub struct {
name string
client __ipc.Client
}
func (c implOAuthBlesserClientStub) c(ctx __context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
func (c implOAuthBlesserClientStub) BlessUsingAccessToken(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, o1 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "BlessUsingAccessToken", []interface{}{i0}, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &o1, &err); ierr != nil {
err = ierr
}
return
}
func (c implOAuthBlesserClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
func (c implOAuthBlesserClientStub) GetMethodTags(ctx __context.T, method string, opts ...__ipc.CallOpt) (o0 []interface{}, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
// OAuthBlesserServerMethods is the interface a server writer
// implements for OAuthBlesser.
//
// OAuthBlesser exchanges OAuth access tokens for
// an email address from an OAuth-based identity provider and uses the email
// address obtained to bless the client.
//
// OAuth is described in RFC 6749 (http://tools.ietf.org/html/rfc6749),
// though the Google implementation also has informative documentation at
// https://developers.google.com/accounts/docs/OAuth2
//
// WARNING: There is no binding between the channel over which the access token
// was obtained (typically https) and the channel used to make the RPC (a
// veyron virtual circuit).
// Thus, if Mallory possesses the access token associated with Alice's account,
// she may be able to obtain a blessing with Alice's name on it.
type OAuthBlesserServerMethods interface {
// BlessUsingAccessToken uses the provided access token to obtain the email
// address and returns a blessing along with the email address.
BlessUsingAccessToken(ctx __ipc.ServerContext, token string) (blessing security.WireBlessings, email string, err error)
}
// OAuthBlesserServerStubMethods is the server interface containing
// OAuthBlesser methods, as expected by ipc.Server.
// There is no difference between this interface and OAuthBlesserServerMethods
// since there are no streaming methods.
type OAuthBlesserServerStubMethods OAuthBlesserServerMethods
// OAuthBlesserServerStub adds universal methods to OAuthBlesserServerStubMethods.
type OAuthBlesserServerStub interface {
OAuthBlesserServerStubMethods
// GetMethodTags will be replaced with DescribeInterfaces.
GetMethodTags(ctx __ipc.ServerContext, method string) ([]interface{}, error)
// Signature will be replaced with DescribeInterfaces.
Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error)
}
// OAuthBlesserServer returns a server stub for OAuthBlesser.
// It converts an implementation of OAuthBlesserServerMethods into
// an object that may be used by ipc.Server.
func OAuthBlesserServer(impl OAuthBlesserServerMethods) OAuthBlesserServerStub {
stub := implOAuthBlesserServerStub{
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 := __ipc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := __ipc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implOAuthBlesserServerStub struct {
impl OAuthBlesserServerMethods
gs *__ipc.GlobState
}
func (s implOAuthBlesserServerStub) BlessUsingAccessToken(ctx __ipc.ServerContext, i0 string) (security.WireBlessings, string, error) {
return s.impl.BlessUsingAccessToken(ctx, i0)
}
func (s implOAuthBlesserServerStub) VGlob() *__ipc.GlobState {
return s.gs
}
func (s implOAuthBlesserServerStub) GetMethodTags(ctx __ipc.ServerContext, method string) ([]interface{}, error) {
// TODO(toddw): Replace with new DescribeInterfaces implementation.
switch method {
case "BlessUsingAccessToken":
return []interface{}{}, nil
default:
return nil, nil
}
}
func (s implOAuthBlesserServerStub) Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) {
// TODO(toddw) Replace with new DescribeInterfaces implementation.
result := __ipc.ServiceSignature{Methods: make(map[string]__ipc.MethodSignature)}
result.Methods["BlessUsingAccessToken"] = __ipc.MethodSignature{
InArgs: []__ipc.MethodArgument{
{Name: "token", Type: 3},
},
OutArgs: []__ipc.MethodArgument{
{Name: "blessing", Type: 74},
{Name: "email", Type: 3},
{Name: "err", Type: 75},
},
}
result.TypeDefs = []__vdlutil.Any{
__wiretype.NamedPrimitiveType{Type: 0x32, Name: "byte", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x41, Name: "", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x42, Name: "ValidatorVOM"},
},
"veyron.io/veyron/veyron2/security.Caveat", []string(nil)},
__wiretype.SliceType{Elem: 0x43, Name: "", Tags: []string(nil)}, __wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/security.Hash", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x42, Name: "Purpose"},
__wiretype.FieldType{Type: 0x45, Name: "Hash"},
__wiretype.FieldType{Type: 0x42, Name: "R"},
__wiretype.FieldType{Type: 0x42, Name: "S"},
},
"veyron.io/veyron/veyron2/security.Signature", []string(nil)},
__wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x3, Name: "Extension"},
__wiretype.FieldType{Type: 0x42, Name: "PublicKey"},
__wiretype.FieldType{Type: 0x44, Name: "Caveats"},
__wiretype.FieldType{Type: 0x46, Name: "Signature"},
},
"veyron.io/veyron/veyron2/security.Certificate", []string(nil)},
__wiretype.SliceType{Elem: 0x47, Name: "", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x48, Name: "", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x49, Name: "CertificateChains"},
},
"veyron.io/veyron/veyron2/security.WireBlessings", []string(nil)},
__wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
return result, nil
}
// MacaroonBlesserClientMethods is the client interface
// containing MacaroonBlesser methods.
//
// MacaroonBlesser returns a blessing given the provided macaroon string.
type MacaroonBlesserClientMethods interface {
// Bless uses the provided macaroon (which contains email and caveats)
// to return a blessing for the client.
Bless(ctx __context.T, macaroon string, opts ...__ipc.CallOpt) (blessing security.WireBlessings, err error)
}
// MacaroonBlesserClientStub adds universal methods to MacaroonBlesserClientMethods.
type MacaroonBlesserClientStub interface {
MacaroonBlesserClientMethods
__ipc.UniversalServiceMethods
}
// MacaroonBlesserClient returns a client stub for MacaroonBlesser.
func MacaroonBlesserClient(name string, opts ...__ipc.BindOpt) MacaroonBlesserClientStub {
var client __ipc.Client
for _, opt := range opts {
if clientOpt, ok := opt.(__ipc.Client); ok {
client = clientOpt
}
}
return implMacaroonBlesserClientStub{name, client}
}
type implMacaroonBlesserClientStub struct {
name string
client __ipc.Client
}
func (c implMacaroonBlesserClientStub) c(ctx __context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.RuntimeFromContext(ctx).Client()
}
func (c implMacaroonBlesserClientStub) Bless(ctx __context.T, i0 string, opts ...__ipc.CallOpt) (o0 security.WireBlessings, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Bless", []interface{}{i0}, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
func (c implMacaroonBlesserClientStub) Signature(ctx __context.T, opts ...__ipc.CallOpt) (o0 __ipc.ServiceSignature, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Signature", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
func (c implMacaroonBlesserClientStub) GetMethodTags(ctx __context.T, method string, opts ...__ipc.CallOpt) (o0 []interface{}, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
// MacaroonBlesserServerMethods is the interface a server writer
// implements for MacaroonBlesser.
//
// MacaroonBlesser returns a blessing given the provided macaroon string.
type MacaroonBlesserServerMethods interface {
// Bless uses the provided macaroon (which contains email and caveats)
// to return a blessing for the client.
Bless(ctx __ipc.ServerContext, macaroon string) (blessing security.WireBlessings, err error)
}
// MacaroonBlesserServerStubMethods is the server interface containing
// MacaroonBlesser methods, as expected by ipc.Server.
// There is no difference between this interface and MacaroonBlesserServerMethods
// since there are no streaming methods.
type MacaroonBlesserServerStubMethods MacaroonBlesserServerMethods
// MacaroonBlesserServerStub adds universal methods to MacaroonBlesserServerStubMethods.
type MacaroonBlesserServerStub interface {
MacaroonBlesserServerStubMethods
// GetMethodTags will be replaced with DescribeInterfaces.
GetMethodTags(ctx __ipc.ServerContext, method string) ([]interface{}, error)
// Signature will be replaced with DescribeInterfaces.
Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error)
}
// MacaroonBlesserServer returns a server stub for MacaroonBlesser.
// It converts an implementation of MacaroonBlesserServerMethods into
// an object that may be used by ipc.Server.
func MacaroonBlesserServer(impl MacaroonBlesserServerMethods) MacaroonBlesserServerStub {
stub := implMacaroonBlesserServerStub{
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 := __ipc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := __ipc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implMacaroonBlesserServerStub struct {
impl MacaroonBlesserServerMethods
gs *__ipc.GlobState
}
func (s implMacaroonBlesserServerStub) Bless(ctx __ipc.ServerContext, i0 string) (security.WireBlessings, error) {
return s.impl.Bless(ctx, i0)
}
func (s implMacaroonBlesserServerStub) VGlob() *__ipc.GlobState {
return s.gs
}
func (s implMacaroonBlesserServerStub) GetMethodTags(ctx __ipc.ServerContext, method string) ([]interface{}, error) {
// TODO(toddw): Replace with new DescribeInterfaces implementation.
switch method {
case "Bless":
return []interface{}{}, nil
default:
return nil, nil
}
}
func (s implMacaroonBlesserServerStub) Signature(ctx __ipc.ServerContext) (__ipc.ServiceSignature, error) {
// TODO(toddw) Replace with new DescribeInterfaces implementation.
result := __ipc.ServiceSignature{Methods: make(map[string]__ipc.MethodSignature)}
result.Methods["Bless"] = __ipc.MethodSignature{
InArgs: []__ipc.MethodArgument{
{Name: "macaroon", Type: 3},
},
OutArgs: []__ipc.MethodArgument{
{Name: "blessing", Type: 74},
{Name: "err", Type: 75},
},
}
result.TypeDefs = []__vdlutil.Any{
__wiretype.NamedPrimitiveType{Type: 0x32, Name: "byte", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x41, Name: "", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x42, Name: "ValidatorVOM"},
},
"veyron.io/veyron/veyron2/security.Caveat", []string(nil)},
__wiretype.SliceType{Elem: 0x43, Name: "", Tags: []string(nil)}, __wiretype.NamedPrimitiveType{Type: 0x3, Name: "veyron.io/veyron/veyron2/security.Hash", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x42, Name: "Purpose"},
__wiretype.FieldType{Type: 0x45, Name: "Hash"},
__wiretype.FieldType{Type: 0x42, Name: "R"},
__wiretype.FieldType{Type: 0x42, Name: "S"},
},
"veyron.io/veyron/veyron2/security.Signature", []string(nil)},
__wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x3, Name: "Extension"},
__wiretype.FieldType{Type: 0x42, Name: "PublicKey"},
__wiretype.FieldType{Type: 0x44, Name: "Caveats"},
__wiretype.FieldType{Type: 0x46, Name: "Signature"},
},
"veyron.io/veyron/veyron2/security.Certificate", []string(nil)},
__wiretype.SliceType{Elem: 0x47, Name: "", Tags: []string(nil)}, __wiretype.SliceType{Elem: 0x48, Name: "", Tags: []string(nil)}, __wiretype.StructType{
[]__wiretype.FieldType{
__wiretype.FieldType{Type: 0x49, Name: "CertificateChains"},
},
"veyron.io/veyron/veyron2/security.WireBlessings", []string(nil)},
__wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
return result, nil
}