File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22from datetime import datetime
33from imio .esign .utils import get_session_annotation
4+ from imio .helpers .ws import verify_auth_token
45from plone .restapi .deserializer import json_body
56from plone .restapi .services import Service
67
@@ -99,7 +100,15 @@ def reply(self): # noqa C901
99100
100101 def authorized (self ):
101102 """Check if the user is authorized to access this service."""
102- return True
103+ # TODO test this code works correctly
104+ auth_header = self .request ._auth
105+ if not auth_header or not auth_header .startswith ("Bearer " ):
106+ return False
107+ try :
108+ token = auth_header .split (" " )[1 ]
109+ except IndexError :
110+ return False
111+ return verify_auth_token (token , groups = ["access_apims-esign" ])
103112
104113
105114"""
You can’t perform that action at this time.
0 commit comments