Skip to content

Commit

Permalink
Merge pull request #69 from informatics-isi-edu/session_proxy
Browse files Browse the repository at this point in the history
ClientSessionCachedProxy
  • Loading branch information
karlcz authored Nov 3, 2023
2 parents 74fd11b + 346dcb7 commit f73088b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions hatrac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ def sample_httpd_config():
<Location /hatrac>
AuthType webauthn
Require webauthn-optional
AuthType none
Require all granted
#AuthType webauthn
#Require webauthn-optional
WSGIProcessGroup hatrac
Expand Down
6 changes: 4 additions & 2 deletions hatrac/rest/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import werkzeug.exceptions
import werkzeug.http

from webauthn2.util import Context, context_from_environment
from webauthn2.util import Context, ClientSessionCachedProxy
from webauthn2.manager import Manager
from webauthn2.rest import format_trace_json, format_final_json

Expand Down Expand Up @@ -222,6 +222,8 @@ class ServerError (RestException):

app.url_map.strict_slashes = False

_client_session_proxy = ClientSessionCachedProxy(core.config.get('webauthn_proxy_config'))

@app.before_request
def before_request():
# request context init
Expand All @@ -240,7 +242,7 @@ def before_request():
directory.prefix = request.environ['SCRIPT_NAME']

# get client authentication context
client_context = context_from_environment(request.environ, fallback=True)
client_context = _client_session_proxy.get_context(request.environ, request.cookies, fallback=True)
set_acl_match_attributes(client_context)
hatrac_ctx.webauthn2_context = client_context

Expand Down

0 comments on commit f73088b

Please sign in to comment.