Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tokenserver/client/tokenclient_test.go

Issue 2785973002: token-server: Add protos for new API for generating service account tokens. (Closed)
Patch Set: more nits Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. 1 // Copyright 2016 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 type fakeRPCClient struct { 96 type fakeRPCClient struct {
97 In minter.MintMachineTokenRequest 97 In minter.MintMachineTokenRequest
98 Out minter.MintMachineTokenResponse 98 Out minter.MintMachineTokenResponse
99 } 99 }
100 100
101 func (f *fakeRPCClient) MintMachineToken(ctx context.Context, in *minter.MintMac hineTokenRequest, opts ...grpc.CallOption) (*minter.MintMachineTokenResponse, er ror) { 101 func (f *fakeRPCClient) MintMachineToken(ctx context.Context, in *minter.MintMac hineTokenRequest, opts ...grpc.CallOption) (*minter.MintMachineTokenResponse, er ror) {
102 f.In = *in 102 f.In = *in
103 return &f.Out, nil 103 return &f.Out, nil
104 } 104 }
105 105
106 func (f *fakeRPCClient) MintDelegationToken(context.Context, *minter.MintDelegat ionTokenRequest, ...grpc.CallOption) (*minter.MintDelegationTokenResponse, error ) {
107 panic("not implemented")
108 }
109
110 // fakeSigner implements Signer. 106 // fakeSigner implements Signer.
111 type fakeSigner struct{} 107 type fakeSigner struct{}
112 108
113 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) { 109 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) {
114 return x509.SHA256WithRSA, nil 110 return x509.SHA256WithRSA, nil
115 } 111 }
116 112
117 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) { 113 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) {
118 return []byte("fake certificate"), nil 114 return []byte("fake certificate"), nil
119 } 115 }
120 116
121 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) { 117 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) {
122 return []byte("fake signature"), nil 118 return []byte("fake signature"), nil
123 } 119 }
OLDNEW
« tokenserver/api/minter/v1/token_minter.proto ('K') | « tokenserver/client/tokenclient.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698