Compare commits
	
		
			No commits in common. "eaa2055c76b9e88fa0cbb582b4e9037e3d8ccf6d" and "ab050ba360c3f613065e365920a080445383d589" have entirely different histories.
		
	
	
		
			eaa2055c76
			...
			ab050ba360
		
	
		
					 2 changed files with 1 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -21,13 +21,7 @@ postgres = [
 | 
			
		|||
	"transaction",
 | 
			
		||||
	"zope.sqlalchemy",
 | 
			
		||||
]
 | 
			
		||||
app = [
 | 
			
		||||
	"python-dotenv", 
 | 
			
		||||
	"zope.authentication",
 | 
			
		||||
	"zope.interface",
 | 
			
		||||
	"zope.publisher", 
 | 
			
		||||
	"zope.traversing",
 | 
			
		||||
]
 | 
			
		||||
app = ["python-dotenv", "zope.publisher", "zope.traversing"]
 | 
			
		||||
test = ["zope.testrunner"]
 | 
			
		||||
#test = ["pytest"]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,38 +0,0 @@
 | 
			
		|||
# scopes.server.auth
 | 
			
		||||
 | 
			
		||||
from zope.authentication.interfaces import IAuthentication
 | 
			
		||||
from zope.interface import implementer
 | 
			
		||||
from zope.publisher.interfaces import Unauthorized
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def authenticate(request):
 | 
			
		||||
    #print('*** authenticate')
 | 
			
		||||
    return None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@implementer(IAuthentication)
 | 
			
		||||
class JwtAuthentication:
 | 
			
		||||
 | 
			
		||||
    def __init__(self, baseAuth):
 | 
			
		||||
        self.baseAuth = baseAuth
 | 
			
		||||
 | 
			
		||||
    def authenticate(self, request):
 | 
			
		||||
        prc = authenticate(request)
 | 
			
		||||
        if prc is None and self.baseAuth is not None:
 | 
			
		||||
            prc = self.baseAuth.authenticate(request)
 | 
			
		||||
        if prc is None:
 | 
			
		||||
            raise Unauthorized
 | 
			
		||||
        return prc
 | 
			
		||||
 | 
			
		||||
    def getPrincipal(self, id):
 | 
			
		||||
        if self.baseAuth is not None:
 | 
			
		||||
            return self.baseAuth.getPrincipal(id)
 | 
			
		||||
 | 
			
		||||
    def unauthenticatedPrincipal(self):
 | 
			
		||||
        if self.baseAuth is not None:
 | 
			
		||||
            return self.baseAuth.unauthenticatedPrincipal()
 | 
			
		||||
 | 
			
		||||
    def unauthorized(self, id, request):
 | 
			
		||||
        if self.baseAuth is not None:
 | 
			
		||||
            return self.baseAuth.unauthorized(id, request)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue