| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Package tokenminter implements TokenMinter API. | 5 // Package tokenminter implements TokenMinter API. |
| 6 // | 6 // |
| 7 // This is main public API of The Token Server. | 7 // This is main public API of The Token Server. |
| 8 package tokenminter | 8 package tokenminter |
| 9 | 9 |
| 10 import ( | 10 import ( |
| 11 "github.com/luci/luci-go/appengine/gaeauth/server/gaesigner" | 11 "github.com/luci/luci-go/appengine/gaeauth/server/gaesigner" |
| 12 | 12 |
| 13 "github.com/luci/luci-go/tokenserver/appengine/impl/certchecker" | 13 "github.com/luci/luci-go/tokenserver/appengine/impl/certchecker" |
| 14 "github.com/luci/luci-go/tokenserver/appengine/impl/delegation" | 14 "github.com/luci/luci-go/tokenserver/appengine/impl/delegation" |
| 15 "github.com/luci/luci-go/tokenserver/appengine/impl/machinetoken" | 15 "github.com/luci/luci-go/tokenserver/appengine/impl/machinetoken" |
| 16 "github.com/luci/luci-go/tokenserver/appengine/impl/serviceaccounts" |
| 16 | 17 |
| 17 "github.com/luci/luci-go/tokenserver/api/minter/v1" | 18 "github.com/luci/luci-go/tokenserver/api/minter/v1" |
| 18 ) | 19 ) |
| 19 | 20 |
| 20 // Server implements minter.TokenMinterServer RPC interface. | 21 // Server implements minter.TokenMinterServer RPC interface. |
| 21 // | 22 // |
| 22 // This is just an assembly of individual method implementations, properly | 23 // This is just an assembly of individual method implementations, properly |
| 23 // configured for use in GAE prod setting. | 24 // configured for use in GAE prod setting. |
| 24 type serverImpl struct { | 25 type serverImpl struct { |
| 25 machinetoken.MintMachineTokenRPC | 26 machinetoken.MintMachineTokenRPC |
| 26 delegation.MintDelegationTokenRPC | 27 delegation.MintDelegationTokenRPC |
| 28 serviceaccounts.MintOAuthTokenGrantRPC |
| 29 serviceaccounts.MintOAuthTokenViaGrantRPC |
| 27 } | 30 } |
| 28 | 31 |
| 29 // NewServer returns prod TokenMinterServer implementation. | 32 // NewServer returns prod TokenMinterServer implementation. |
| 30 // | 33 // |
| 31 // It does all authorization checks inside. | 34 // It does all authorization checks inside. |
| 32 func NewServer() minter.TokenMinterServer { | 35 func NewServer() minter.TokenMinterServer { |
| 33 return &serverImpl{ | 36 return &serverImpl{ |
| 34 MintMachineTokenRPC: machinetoken.MintMachineTokenRPC{ | 37 MintMachineTokenRPC: machinetoken.MintMachineTokenRPC{ |
| 35 Signer: gaesigner.Signer{}, | 38 Signer: gaesigner.Signer{}, |
| 36 CheckCertificate: certchecker.CheckCertificate, | 39 CheckCertificate: certchecker.CheckCertificate, |
| 37 LogToken: machinetoken.LogToken, | 40 LogToken: machinetoken.LogToken, |
| 38 }, | 41 }, |
| 39 MintDelegationTokenRPC: delegation.MintDelegationTokenRPC{ | 42 MintDelegationTokenRPC: delegation.MintDelegationTokenRPC{ |
| 40 Signer: gaesigner.Signer{}, | 43 Signer: gaesigner.Signer{}, |
| 41 ConfigLoader: delegation.DelegationConfigLoader, | 44 ConfigLoader: delegation.DelegationConfigLoader, |
| 42 LogToken: delegation.LogToken, | 45 LogToken: delegation.LogToken, |
| 43 }, | 46 }, |
| 44 } | 47 } |
| 45 } | 48 } |
| OLD | NEW |