@@ -52,9 +52,12 @@ func (s *sessionRpcServer) AddSession(_ context.Context,
5252 return nil , err
5353 }
5454
55- if typ != session .TypeUIPassword && typ != session .TypeMacaroonAdmin {
55+ if typ != session .TypeUIPassword && typ != session .TypeMacaroonAdmin &&
56+ typ != session .TypeMacaroonReadonly {
57+
5658 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" )
5861 }
5962
6063 sess , err := session .NewSession (
@@ -116,11 +119,12 @@ func (s *sessionRpcServer) resumeSession(sess *session.Session) error {
116119 case session .TypeUIPassword :
117120 authData = []byte ("Authorization: Basic " + s .basicAuth )
118121
119- case session .TypeMacaroonAdmin :
122+ case session .TypeMacaroonAdmin , session . TypeMacaroonReadonly :
120123 ctx := context .Background ()
124+ readOnly := sess .Type == session .TypeMacaroonReadonly
121125 mac , err := s .superMacBaker (
122126 ctx , sess .MacaroonRootKey , & session.MacaroonRecipe {
123- Permissions : getAllPermissions (false ),
127+ Permissions : getAllPermissions (readOnly ),
124128 },
125129 )
126130 if err != nil {
0 commit comments