OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package common | 4 package common |
5 | 5 |
6 // Tagger is implemented by any entity with a Tag method, which should | 6 // Tagger is implemented by any entity with a Tag method, which should |
7 // return the tag of the entity (for instance a machine might return | 7 // return the tag of the entity (for instance a machine might return |
8 // the tag "machine-1") | 8 // the tag "machine-1") |
9 type Tagger interface { | 9 type Tagger interface { |
10 Tag() string | 10 Tag() string |
11 } | 11 } |
12 | 12 |
13 // Authorizer represents a value that can be asked for authorization | 13 // Authorizer represents a value that can be asked for authorization |
14 // information on its associated authenticated entity. It is | 14 // information on its associated authenticated entity. It is |
15 // implemented by an API server to allow an API implementation to ask | 15 // implemented by an API server to allow an API implementation to ask |
16 // questions about the client that is currently connected. | 16 // questions about the client that is currently connected. |
17 type Authorizer interface { | 17 type Authorizer interface { |
18 // IsLoggedIn returns whether the user is currently logged in and | 18 // IsLoggedIn returns whether the user is currently logged in and |
19 // authenticated. | 19 // authenticated. |
20 IsLoggedIn() bool | 20 IsLoggedIn() bool |
21 | 21 |
22 // AuthMachineAgent returns whether the authenticated entity is a | 22 // AuthMachineAgent returns whether the authenticated entity is a |
23 // machine agent. | 23 // machine agent. |
24 AuthMachineAgent() bool | 24 AuthMachineAgent() bool |
25 | 25 |
26 // AuthOwner returns whether the authenticated entity is the same | 26 // AuthOwner returns whether the authenticated entity is the same |
27 // as the given entity. | 27 // as the given entity. |
28 » AuthOwner(entity Tagger) bool | 28 » AuthOwner(tag string) bool |
29 | 29 |
30 // AuthEnvironManager returns whether the authenticated entity is | 30 // AuthEnvironManager returns whether the authenticated entity is |
31 // a machine running the environment manager job. | 31 // a machine running the environment manager job. |
32 AuthEnvironManager() bool | 32 AuthEnvironManager() bool |
33 } | 33 } |
OLD | NEW |