@@ -52,9 +52,12 @@ func (s *sessionRpcServer) AddSession(_ context.Context,
52
52
return nil , err
53
53
}
54
54
55
- if typ != session .TypeUIPassword && typ != session .TypeMacaroonAdmin {
55
+ if typ != session .TypeUIPassword && typ != session .TypeMacaroonAdmin &&
56
+ typ != session .TypeMacaroonReadonly {
57
+
56
58
return nil , fmt .Errorf ("invalid session type, only UI " +
57
- "password and macaroon admin types supported in LiT" )
59
+ "password, admin and readonly macaroon types " +
60
+ "supported in LiT" )
58
61
}
59
62
60
63
sess , err := session .NewSession (
@@ -116,11 +119,12 @@ func (s *sessionRpcServer) resumeSession(sess *session.Session) error {
116
119
case session .TypeUIPassword :
117
120
authData = []byte ("Authorization: Basic " + s .basicAuth )
118
121
119
- case session .TypeMacaroonAdmin :
122
+ case session .TypeMacaroonAdmin , session . TypeMacaroonReadonly :
120
123
ctx := context .Background ()
124
+ readOnly := sess .Type == session .TypeMacaroonReadonly
121
125
mac , err := s .superMacBaker (
122
126
ctx , sess .MacaroonRootKey , & session.MacaroonRecipe {
123
- Permissions : getAllPermissions (false ),
127
+ Permissions : getAllPermissions (readOnly ),
124
128
},
125
129
)
126
130
if err != nil {
0 commit comments