Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed potential deadlocks by opening sessions only on demand #1439

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
5ec60e6
Refactoring in prep for adding connectionless proof demo
ianco Sep 2, 2021
debb995
Add connectionless proof request support
ianco Sep 3, 2021
a96cefd
Display url's
ianco Sep 3, 2021
8848263
Fix url for qr code
ianco Sep 7, 2021
0d6de45
Fix url for qr code
ianco Sep 7, 2021
1c1e046
Fix url's for proof request
ianco Sep 7, 2021
7792065
Use birth date instead of age in cred and proof request
ianco Sep 7, 2021
9df08f5
Update some docs
ianco Sep 7, 2021
cb7302c
Update some docs
ianco Sep 7, 2021
997ef2d
import cleanups
andrewwhitehead Sep 3, 2021
f1d25f4
Run integration tests using external ledger and tails server
ianco Sep 7, 2021
c390124
Run integration tests using external ledger and tails server
ianco Sep 7, 2021
1196397
Run integration tests using external ledger and tails server
ianco Sep 7, 2021
1355c8b
Some misc cleanup
ianco Sep 8, 2021
58c3852
Fix aip 20 behaviour
ianco Sep 9, 2021
154bf9c
Typos in the demo's README.md
pavlos-p Sep 9, 2021
a0b3de1
Fix typo
ianco Sep 9, 2021
0c8b6e1
log info for non supported problem-report code
shaangill025 Sep 10, 2021
8a4d7a5
root profile in inbound transport
burdettadam Sep 9, 2021
caaec4c
removed explicit param handling
burdettadam Sep 9, 2021
198e986
feat(IDENT-3334): Encode DIDComm messages before pushing It to the queue
acuderman Sep 10, 2021
037c8db
feat(IDENT-3334): Fix Basewire injection
acuderman Sep 10, 2021
5fffede
fix(IDENT-3334): Fix lint issues
acuderman Sep 10, 2021
8b5c86b
fix(IDENT-3334): Fix lint issues
acuderman Sep 10, 2021
5fe5930
fix(IDENT-3334): Add blank line
acuderman Sep 10, 2021
47b5a17
Revert "fix(IDENT-3334): Add blank line"
acuderman Sep 10, 2021
2b5497e
updates based on feedback
shaangill025 Sep 13, 2021
2bd3872
Make requested attributes and predicates required on indy proof request
ianco Sep 13, 2021
6673660
Fix order of startup params for faber agent
ianco Sep 15, 2021
009ea36
Fix order of startup params for faber agent
ianco Sep 15, 2021
eb375cd
aca-py args for endorser protocol
ianco Sep 17, 2021
110ddc6
When fetching the admin config, don't overwrie webhook settings
ianco Sep 20, 2021
9184792
Code cleanup
ianco Sep 21, 2021
ddee416
unprotect liveness and readiness endpoints
weiiv Sep 16, 2021
2e9d1bc
Isolate mediation setup tests in a separate class.
chumbert Sep 3, 2021
bfa5eb6
Make mediation invitation parameter idempotent
chumbert Sep 6, 2021
aa08e0d
When setting up mediation: clear previous default
chumbert Sep 13, 2021
0c5c5f2
Left-behind formatting
chumbert Sep 14, 2021
a3787c7
Mediation invite is not mandatory if provided at provision time
chumbert Sep 17, 2021
8abf1c7
Endorser params and automation; alice/faber integration WIP
ianco Sep 23, 2021
d125343
Fix black formatting
ianco Sep 23, 2021
0c65c4b
Endorser automation of steps
ianco Sep 24, 2021
ab7c9ed
Update create cred def
ianco Sep 27, 2021
15547c7
Update revocation endpoints to check for author role
ianco Sep 27, 2021
7225951
Pass revocation params to alice demo
ianco Sep 28, 2021
cabaa43
Add txn auto-request for revocation endpoints
ianco Sep 28, 2021
f15fbd3
Automate revocation steps for cred def setup
ianco Sep 29, 2021
a33edfa
feat(IDENT-3499): Add support for json_ld offers from the proposal
acuderman Sep 29, 2021
b203c5f
style(IDENT-3499): Remove unneeded cred_Ex_record from create_offer fn
acuderman Sep 29, 2021
971b068
Formatting fixes
ianco Sep 29, 2021
90a561e
Added an integration test for the autoated endorsement scenario
ianco Sep 29, 2021
603bade
feat: include pattern and match information in events
dbluhm Sep 29, 2021
a8c4163
fix: unwrap iteration through subscribers
dbluhm Sep 29, 2021
782bb6e
Update CONTRIBUTING.md
ryjones Sep 30, 2021
8b340fc
feat(IDENT-3404): Replace session usage with profiles
acuderman Sep 21, 2021
8535b6a
fix(IDENT-3404): Fix test dependency injection
acuderman Sep 21, 2021
dd1de9e
style(IDENT-3404): Set repeated sequence to a variable
acuderman Sep 21, 2021
b33b2d4
fix(IDENT-3404): Fetch from db only when required
acuderman Sep 21, 2021
1906dbd
feat(IDENT-3406): Refactor DidX manager to accept profile
acuderman Sep 21, 2021
76933fc
feat(IDENT-3406): Open sessions on demand DidX manager
acuderman Sep 21, 2021
7b3f3c8
feat IDENT-3371: Merged code from different managers
acuderman Sep 24, 2021
2c91b55
fix IDENT-3371: Removed logging
Sep 22, 2021
04ba26f
feat(IDENT-3414): Create wallet sessions only on demand-Connections mgr
acuderman Sep 24, 2021
456b8bd
feat(IDENT-3414): Update connection manager tests with profile
acuderman Sep 22, 2021
c6a083d
fix(IDENT-3414): Fix connections routes session opening
acuderman Sep 23, 2021
7ba700c
style(IDENT-3414): Lint fix
acuderman Sep 23, 2021
83df4f2
feat(IDENT-3414): Create wallet sessions only on demand-Connections mgr
acuderman Sep 24, 2021
a797a65
fix(IDENT-3371): Open sessions with async context in connections tests
acuderman Sep 30, 2021
cb62fd8
feat IDENT-3371: fixing session usage in tests
zanost Sep 30, 2021
677486f
fix(IDENT-3371): Open session with async context out of band tests
acuderman Sep 30, 2021
0190014
feat IDENT-3371: fixing this.profile in tests
zanost Sep 30, 2021
78c9ee9
style(IDENT-3371): Fix lint
acuderman Sep 30, 2021
0815d71
Added endorser docs
ianco Oct 1, 2021
3004845
feat IDENT-3521 started implementation
Oct 6, 2021
066a824
fix IDENT-3521: Fixed somments from other MR
Oct 6, 2021
8050be0
feat IDENT-3521: Fixed manager.py
Oct 7, 2021
9f16705
Removed oopenning on not needed sessions
Oct 7, 2021
372abe8
feat IDENT-3522: Use context.profile to create sessions
LisandroV Oct 6, 2021
0dd3c4b
feat IDENT-3523: On-demand sessions for coordinate_mediation protocol
LisandroV Oct 8, 2021
b080085
fix IDENT-3523: Moved async call out of session
Oct 8, 2021
a4b4d76
fix IDENT-3523: Renamed variable
Oct 8, 2021
c7d5549
fix IDENT-3524: Started implementation
Oct 6, 2021
1498b38
feat IDENT-3524: Removed session openning for base manager
Oct 7, 2021
5bd788c
fix IDENT-3524: Fixed Multitentnat manager session opening
Oct 7, 2021
ea62ae0
fix IDENT-3524: Fixed failing tests
Oct 7, 2021
f627d36
fix IDENT-3524: Removed unneded test setup
Oct 8, 2021
1a0ef10
fix IDENT-3524: Fixed potential deadlock
Oct 8, 2021
a792132
fix IDENT-3524: Added addition variable for context.profile
Oct 8, 2021
4fb0d65
fix IDENT-3524: Fixed to use async with profile.session()
Oct 8, 2021
34acd82
fix IDENT-3524: Removed potential deadlock
Oct 8, 2021
85c11a2
Lint fix
Oct 11, 2021
aba4a54
Release 0.7.2-rc0 preparation
swcurran Oct 5, 2021
f27c232
fix IDENT-3372: Fixed Faber demo
Oct 11, 2021
23dac1f
Merge branch 'main' of github.com:globalid/aries-cloudagent-python in…
Oct 11, 2021
87cb2f8
Merge branch 'main' of https://github.com/hyperledger/aries-cloudagen…
Oct 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 61 additions & 58 deletions aries_cloudagent/multitenant/admin/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,20 @@ async def wallets_list(request: web.BaseRequest):
"""

context: AdminRequestContext = request["context"]
profile = context.profile

query = {}
wallet_name = request.query.get("wallet_name")
if wallet_name:
query["wallet_name"] = wallet_name

async with context.session() as session:
try:
try:
async with profile.session() as session:
records = await WalletRecord.query(session, tag_filter=query)
results = [format_wallet_record(record) for record in records]
results.sort(key=lambda w: w["created_at"])
except (StorageError, BaseModelError) as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
results = [format_wallet_record(record) for record in records]
results.sort(key=lambda w: w["created_at"])
except (StorageError, BaseModelError) as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err

return web.json_response({"results": results})

Expand All @@ -255,16 +256,17 @@ async def wallet_get(request: web.BaseRequest):
"""

context: AdminRequestContext = request["context"]
profile = context.profile
wallet_id = request.match_info["wallet_id"]

async with context.session() as session:
try:
try:
async with profile.session() as session:
wallet_record = await WalletRecord.retrieve_by_id(session, wallet_id)
result = format_wallet_record(wallet_record)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except BaseModelError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
result = format_wallet_record(wallet_record)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except BaseModelError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err

return web.json_response(result)

Expand Down Expand Up @@ -306,17 +308,16 @@ async def wallet_create(request: web.BaseRequest):
if image_url:
settings["image_url"] = image_url

async with context.session() as session:
try:
multitenant_mgr = session.inject(BaseMultitenantManager)
try:
multitenant_mgr = context.profile.inject(BaseMultitenantManager)

wallet_record = await multitenant_mgr.create_wallet(
settings, key_management_mode
)
wallet_record = await multitenant_mgr.create_wallet(
settings, key_management_mode
)

token = multitenant_mgr.create_auth_token(wallet_record, wallet_key)
except BaseError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
token = multitenant_mgr.create_auth_token(wallet_record, wallet_key)
except BaseError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err

result = {
**format_wallet_record(wallet_record),
Expand Down Expand Up @@ -368,15 +369,15 @@ async def wallet_update(request: web.BaseRequest):
if image_url is not None:
settings["image_url"] = image_url

async with context.session() as session:
try:
multitenant_mgr = session.inject(BaseMultitenantManager)
wallet_record = await multitenant_mgr.update_wallet(wallet_id, settings)
result = format_wallet_record(wallet_record)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletSettingsError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err
try:
multitenant_mgr = context.profile.inject(BaseMultitenantManager)
wallet_record = await multitenant_mgr.update_wallet(wallet_id, settings)

result = format_wallet_record(wallet_record)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletSettingsError as err:
raise web.HTTPBadRequest(reason=err.roll_up) from err

return web.json_response(result)

Expand All @@ -400,22 +401,23 @@ async def wallet_create_token(request: web.BaseRequest):
body = await request.json()
wallet_key = body.get("wallet_key")

async with context.session() as session:
try:
multitenant_mgr = session.inject(BaseMultitenantManager)
profile = context.profile
try:
multitenant_mgr = profile.inject(BaseMultitenantManager)
async with profile.session() as session:
wallet_record = await WalletRecord.retrieve_by_id(session, wallet_id)

if (not wallet_record.requires_external_key) and wallet_key:
raise web.HTTPBadRequest(
reason=f"Wallet {wallet_id} doesn't require"
" the wallet key to be provided"
)
if (not wallet_record.requires_external_key) and wallet_key:
raise web.HTTPBadRequest(
reason=f"Wallet {wallet_id} doesn't require"
" the wallet key to be provided"
)

token = multitenant_mgr.create_auth_token(wallet_record, wallet_key)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletKeyMissingError as err:
raise web.HTTPUnauthorized(reason=err.roll_up) from err
token = multitenant_mgr.create_auth_token(wallet_record, wallet_key)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletKeyMissingError as err:
raise web.HTTPUnauthorized(reason=err.roll_up) from err

return web.json_response({"token": token})

Expand Down Expand Up @@ -444,22 +446,23 @@ async def wallet_remove(request: web.BaseRequest):
body = await request.json()
wallet_key = body.get("wallet_key")

async with context.session() as session:
try:
multitenant_mgr = session.inject(BaseMultitenantManager)
profile = context.profile
try:
multitenant_mgr = profile.inject(BaseMultitenantManager)
async with profile.session() as session:
wallet_record = await WalletRecord.retrieve_by_id(session, wallet_id)

if (not wallet_record.requires_external_key) and wallet_key:
raise web.HTTPBadRequest(
reason=f"Wallet {wallet_id} doesn't require"
" the wallet key to be provided"
)

await multitenant_mgr.remove_wallet(wallet_id, wallet_key)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletKeyMissingError as err:
raise web.HTTPUnauthorized(reason=err.roll_up) from err
if (not wallet_record.requires_external_key) and wallet_key:
raise web.HTTPBadRequest(
reason=f"Wallet {wallet_id} doesn't require"
" the wallet key to be provided"
)

await multitenant_mgr.remove_wallet(wallet_id, wallet_key)
except StorageNotFoundError as err:
raise web.HTTPNotFound(reason=err.roll_up) from err
except WalletKeyMissingError as err:
raise web.HTTPUnauthorized(reason=err.roll_up) from err

return web.json_response({})

Expand Down
Loading