| OLD | NEW |
| 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 // Package tokenminter implements TokenMinter API. | 15 // Package tokenminter implements TokenMinter API. |
| 16 // | 16 // |
| 17 // This is main public API of The Token Server. | 17 // This is main public API of The Token Server. |
| 18 package tokenminter | 18 package tokenminter |
| 19 | 19 |
| 20 import ( | 20 import ( |
| 21 "github.com/luci/luci-go/appengine/gaeauth/server/gaesigner" | 21 "github.com/luci/luci-go/appengine/gaeauth/server/gaesigner" |
| 22 | 22 |
| 23 "github.com/luci/luci-go/tokenserver/appengine/impl/certchecker" | 23 "github.com/luci/luci-go/tokenserver/appengine/impl/certchecker" |
| 24 "github.com/luci/luci-go/tokenserver/appengine/impl/delegation" | 24 "github.com/luci/luci-go/tokenserver/appengine/impl/delegation" |
| 25 "github.com/luci/luci-go/tokenserver/appengine/impl/machinetoken" | 25 "github.com/luci/luci-go/tokenserver/appengine/impl/machinetoken" |
| 26 "github.com/luci/luci-go/tokenserver/appengine/impl/serviceaccounts" |
| 26 | 27 |
| 27 "github.com/luci/luci-go/tokenserver/api/minter/v1" | 28 "github.com/luci/luci-go/tokenserver/api/minter/v1" |
| 28 ) | 29 ) |
| 29 | 30 |
| 30 // Server implements minter.TokenMinterServer RPC interface. | 31 // Server implements minter.TokenMinterServer RPC interface. |
| 31 // | 32 // |
| 32 // This is just an assembly of individual method implementations, properly | 33 // This is just an assembly of individual method implementations, properly |
| 33 // configured for use in GAE prod setting. | 34 // configured for use in GAE prod setting. |
| 34 type serverImpl struct { | 35 type serverImpl struct { |
| 35 machinetoken.MintMachineTokenRPC | 36 machinetoken.MintMachineTokenRPC |
| 36 delegation.MintDelegationTokenRPC | 37 delegation.MintDelegationTokenRPC |
| 38 serviceaccounts.MintOAuthTokenGrantRPC |
| 39 serviceaccounts.MintOAuthTokenViaGrantRPC |
| 37 } | 40 } |
| 38 | 41 |
| 39 // NewServer returns prod TokenMinterServer implementation. | 42 // NewServer returns prod TokenMinterServer implementation. |
| 40 // | 43 // |
| 41 // It does all authorization checks inside. | 44 // It does all authorization checks inside. |
| 42 func NewServer() minter.TokenMinterServer { | 45 func NewServer() minter.TokenMinterServer { |
| 43 return &serverImpl{ | 46 return &serverImpl{ |
| 44 MintMachineTokenRPC: machinetoken.MintMachineTokenRPC{ | 47 MintMachineTokenRPC: machinetoken.MintMachineTokenRPC{ |
| 45 Signer: gaesigner.Signer{}, | 48 Signer: gaesigner.Signer{}, |
| 46 CheckCertificate: certchecker.CheckCertificate, | 49 CheckCertificate: certchecker.CheckCertificate, |
| 47 LogToken: machinetoken.LogToken, | 50 LogToken: machinetoken.LogToken, |
| 48 }, | 51 }, |
| 49 MintDelegationTokenRPC: delegation.MintDelegationTokenRPC{ | 52 MintDelegationTokenRPC: delegation.MintDelegationTokenRPC{ |
| 50 Signer: gaesigner.Signer{}, | 53 Signer: gaesigner.Signer{}, |
| 51 Rules: delegation.GlobalRulesCache.Rules, | 54 Rules: delegation.GlobalRulesCache.Rules, |
| 52 LogToken: delegation.LogToken, | 55 LogToken: delegation.LogToken, |
| 53 }, | 56 }, |
| 54 } | 57 } |
| 55 } | 58 } |
| OLD | NEW |