From 41da7a8b50ac8a863eebed250956b2aadb8a579c Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sun, 19 May 2024 22:49:42 +0800 Subject: [PATCH 01/10] Add python-keycloak to Pipfile --- Pipfile | 1 + Pipfile.lock | 295 +++++++++++++++++++++++++++++---------------------- 2 files changed, 169 insertions(+), 127 deletions(-) diff --git a/Pipfile b/Pipfile index d10a323..3c30c6b 100644 --- a/Pipfile +++ b/Pipfile @@ -33,6 +33,7 @@ setuptools = "*" cryptography = "*" werkzeug = "*" importlib-metadata = "*" +python-keycloak = "*" [pipenv] allow_prereleases = false diff --git a/Pipfile.lock b/Pipfile.lock index 55d5d56..d913403 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "8a037c60558ff243346d1306715a6de10d66e3d28785f6ff42f2c1aa878378a2" + "sha256": "cd79f1e1fc41ec9bc37e741d579d315fa08be75a9ad5d099881b55fe041ca659" }, "pipfile-spec": 6, "requires": { @@ -168,12 +168,12 @@ }, "certifi": { "hashes": [ - "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082", - "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9" + "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f", + "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1" ], "index": "pypi", "markers": "python_version >= '3.6'", - "version": "==2023.7.22" + "version": "==2024.2.2" }, "cffi": { "hashes": [ @@ -230,104 +230,104 @@ "sha256:fa3a0128b152627161ce47201262d3140edb5a5c3da88d73a1b790a959126956", "sha256:fcc8eb6d5902bb1cf6dc4f187ee3ea80a1eba0a89aba40a5cb20a5087d961357" ], - "markers": "python_version >= '3.8'", + "markers": "platform_python_implementation != 'PyPy'", "version": "==1.16.0" }, "charset-normalizer": { "hashes": [ - "sha256:02673e456dc5ab13659f85196c534dc596d4ef260e4d86e856c3b2773ce09843", - "sha256:02af06682e3590ab952599fbadac535ede5d60d78848e555aa58d0c0abbde786", - "sha256:03680bb39035fbcffe828eae9c3f8afc0428c91d38e7d61aa992ef7a59fb120e", - "sha256:0570d21da019941634a531444364f2482e8db0b3425fcd5ac0c36565a64142c8", - "sha256:09c77f964f351a7369cc343911e0df63e762e42bac24cd7d18525961c81754f4", - "sha256:0d3d5b7db9ed8a2b11a774db2bbea7ba1884430a205dbd54a32d61d7c2a190fa", - "sha256:1063da2c85b95f2d1a430f1c33b55c9c17ffaf5e612e10aeaad641c55a9e2b9d", - "sha256:12ebea541c44fdc88ccb794a13fe861cc5e35d64ed689513a5c03d05b53b7c82", - "sha256:153e7b6e724761741e0974fc4dcd406d35ba70b92bfe3fedcb497226c93b9da7", - "sha256:15b26ddf78d57f1d143bdf32e820fd8935d36abe8a25eb9ec0b5a71c82eb3895", - "sha256:1872d01ac8c618a8da634e232f24793883d6e456a66593135aeafe3784b0848d", - "sha256:187d18082694a29005ba2944c882344b6748d5be69e3a89bf3cc9d878e548d5a", - "sha256:1b2919306936ac6efb3aed1fbf81039f7087ddadb3160882a57ee2ff74fd2382", - "sha256:232ac332403e37e4a03d209a3f92ed9071f7d3dbda70e2a5e9cff1c4ba9f0678", - "sha256:23e8565ab7ff33218530bc817922fae827420f143479b753104ab801145b1d5b", - "sha256:24817cb02cbef7cd499f7c9a2735286b4782bd47a5b3516a0e84c50eab44b98e", - "sha256:249c6470a2b60935bafd1d1d13cd613f8cd8388d53461c67397ee6a0f5dce741", - "sha256:24a91a981f185721542a0b7c92e9054b7ab4fea0508a795846bc5b0abf8118d4", - "sha256:2502dd2a736c879c0f0d3e2161e74d9907231e25d35794584b1ca5284e43f596", - "sha256:250c9eb0f4600361dd80d46112213dff2286231d92d3e52af1e5a6083d10cad9", - "sha256:278c296c6f96fa686d74eb449ea1697f3c03dc28b75f873b65b5201806346a69", - "sha256:2935ffc78db9645cb2086c2f8f4cfd23d9b73cc0dc80334bc30aac6f03f68f8c", - "sha256:2f4a0033ce9a76e391542c182f0d48d084855b5fcba5010f707c8e8c34663d77", - "sha256:30a85aed0b864ac88309b7d94be09f6046c834ef60762a8833b660139cfbad13", - "sha256:380c4bde80bce25c6e4f77b19386f5ec9db230df9f2f2ac1e5ad7af2caa70459", - "sha256:3ae38d325b512f63f8da31f826e6cb6c367336f95e418137286ba362925c877e", - "sha256:3b447982ad46348c02cb90d230b75ac34e9886273df3a93eec0539308a6296d7", - "sha256:3debd1150027933210c2fc321527c2299118aa929c2f5a0a80ab6953e3bd1908", - "sha256:4162918ef3098851fcd8a628bf9b6a98d10c380725df9e04caf5ca6dd48c847a", - "sha256:468d2a840567b13a590e67dd276c570f8de00ed767ecc611994c301d0f8c014f", - "sha256:4cc152c5dd831641e995764f9f0b6589519f6f5123258ccaca8c6d34572fefa8", - "sha256:542da1178c1c6af8873e143910e2269add130a299c9106eef2594e15dae5e482", - "sha256:557b21a44ceac6c6b9773bc65aa1b4cc3e248a5ad2f5b914b91579a32e22204d", - "sha256:5707a746c6083a3a74b46b3a631d78d129edab06195a92a8ece755aac25a3f3d", - "sha256:588245972aca710b5b68802c8cad9edaa98589b1b42ad2b53accd6910dad3545", - "sha256:5adf257bd58c1b8632046bbe43ee38c04e1038e9d37de9c57a94d6bd6ce5da34", - "sha256:619d1c96099be5823db34fe89e2582b336b5b074a7f47f819d6b3a57ff7bdb86", - "sha256:63563193aec44bce707e0c5ca64ff69fa72ed7cf34ce6e11d5127555756fd2f6", - "sha256:67b8cc9574bb518ec76dc8e705d4c39ae78bb96237cb533edac149352c1f39fe", - "sha256:6a685067d05e46641d5d1623d7c7fdf15a357546cbb2f71b0ebde91b175ffc3e", - "sha256:70f1d09c0d7748b73290b29219e854b3207aea922f839437870d8cc2168e31cc", - "sha256:750b446b2ffce1739e8578576092179160f6d26bd5e23eb1789c4d64d5af7dc7", - "sha256:7966951325782121e67c81299a031f4c115615e68046f79b85856b86ebffc4cd", - "sha256:7b8b8bf1189b3ba9b8de5c8db4d541b406611a71a955bbbd7385bbc45fcb786c", - "sha256:7f5d10bae5d78e4551b7be7a9b29643a95aded9d0f602aa2ba584f0388e7a557", - "sha256:805dfea4ca10411a5296bcc75638017215a93ffb584c9e344731eef0dcfb026a", - "sha256:81bf654678e575403736b85ba3a7867e31c2c30a69bc57fe88e3ace52fb17b89", - "sha256:82eb849f085624f6a607538ee7b83a6d8126df6d2f7d3b319cb837b289123078", - "sha256:85a32721ddde63c9df9ebb0d2045b9691d9750cb139c161c80e500d210f5e26e", - "sha256:86d1f65ac145e2c9ed71d8ffb1905e9bba3a91ae29ba55b4c46ae6fc31d7c0d4", - "sha256:86f63face3a527284f7bb8a9d4f78988e3c06823f7bea2bd6f0e0e9298ca0403", - "sha256:8eaf82f0eccd1505cf39a45a6bd0a8cf1c70dcfc30dba338207a969d91b965c0", - "sha256:93aa7eef6ee71c629b51ef873991d6911b906d7312c6e8e99790c0f33c576f89", - "sha256:96c2b49eb6a72c0e4991d62406e365d87067ca14c1a729a870d22354e6f68115", - "sha256:9cf3126b85822c4e53aa28c7ec9869b924d6fcfb76e77a45c44b83d91afd74f9", - "sha256:9fe359b2e3a7729010060fbca442ca225280c16e923b37db0e955ac2a2b72a05", - "sha256:a0ac5e7015a5920cfce654c06618ec40c33e12801711da6b4258af59a8eff00a", - "sha256:a3f93dab657839dfa61025056606600a11d0b696d79386f974e459a3fbc568ec", - "sha256:a4b71f4d1765639372a3b32d2638197f5cd5221b19531f9245fcc9ee62d38f56", - "sha256:aae32c93e0f64469f74ccc730a7cb21c7610af3a775157e50bbd38f816536b38", - "sha256:aaf7b34c5bc56b38c931a54f7952f1ff0ae77a2e82496583b247f7c969eb1479", - "sha256:abecce40dfebbfa6abf8e324e1860092eeca6f7375c8c4e655a8afb61af58f2c", - "sha256:abf0d9f45ea5fb95051c8bfe43cb40cda383772f7e5023a83cc481ca2604d74e", - "sha256:ac71b2977fb90c35d41c9453116e283fac47bb9096ad917b8819ca8b943abecd", - "sha256:ada214c6fa40f8d800e575de6b91a40d0548139e5dc457d2ebb61470abf50186", - "sha256:b09719a17a2301178fac4470d54b1680b18a5048b481cb8890e1ef820cb80455", - "sha256:b1121de0e9d6e6ca08289583d7491e7fcb18a439305b34a30b20d8215922d43c", - "sha256:b3b2316b25644b23b54a6f6401074cebcecd1244c0b8e80111c9a3f1c8e83d65", - "sha256:b3d9b48ee6e3967b7901c052b670c7dda6deb812c309439adaffdec55c6d7b78", - "sha256:b5bcf60a228acae568e9911f410f9d9e0d43197d030ae5799e20dca8df588287", - "sha256:b8f3307af845803fb0b060ab76cf6dd3a13adc15b6b451f54281d25911eb92df", - "sha256:c2af80fb58f0f24b3f3adcb9148e6203fa67dd3f61c4af146ecad033024dde43", - "sha256:c350354efb159b8767a6244c166f66e67506e06c8924ed74669b2c70bc8735b1", - "sha256:c5a74c359b2d47d26cdbbc7845e9662d6b08a1e915eb015d044729e92e7050b7", - "sha256:c71f16da1ed8949774ef79f4a0260d28b83b3a50c6576f8f4f0288d109777989", - "sha256:d47ecf253780c90ee181d4d871cd655a789da937454045b17b5798da9393901a", - "sha256:d7eff0f27edc5afa9e405f7165f85a6d782d308f3b6b9d96016c010597958e63", - "sha256:d97d85fa63f315a8bdaba2af9a6a686e0eceab77b3089af45133252618e70884", - "sha256:db756e48f9c5c607b5e33dd36b1d5872d0422e960145b08ab0ec7fd420e9d649", - "sha256:dc45229747b67ffc441b3de2f3ae5e62877a282ea828a5bdb67883c4ee4a8810", - "sha256:e0fc42822278451bc13a2e8626cf2218ba570f27856b536e00cfa53099724828", - "sha256:e39c7eb31e3f5b1f88caff88bcff1b7f8334975b46f6ac6e9fc725d829bc35d4", - "sha256:e46cd37076971c1040fc8c41273a8b3e2c624ce4f2be3f5dfcb7a430c1d3acc2", - "sha256:e5c1502d4ace69a179305abb3f0bb6141cbe4714bc9b31d427329a95acfc8bdd", - "sha256:edfe077ab09442d4ef3c52cb1f9dab89bff02f4524afc0acf2d46be17dc479f5", - "sha256:effe5406c9bd748a871dbcaf3ac69167c38d72db8c9baf3ff954c344f31c4cbe", - "sha256:f0d1e3732768fecb052d90d62b220af62ead5748ac51ef61e7b32c266cac9293", - "sha256:f5969baeaea61c97efa706b9b107dcba02784b1601c74ac84f2a532ea079403e", - "sha256:f8888e31e3a85943743f8fc15e71536bda1c81d5aa36d014a3c0c44481d7db6e", - "sha256:fc52b79d83a3fe3a360902d3f5d79073a993597d48114c29485e9431092905d8" + "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027", + "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087", + "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786", + "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8", + "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09", + "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185", + "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574", + "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e", + "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519", + "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898", + "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269", + "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3", + "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f", + "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6", + "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8", + "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a", + "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73", + "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc", + "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714", + "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2", + "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc", + "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce", + "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d", + "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e", + "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6", + "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269", + "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96", + "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d", + "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a", + "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4", + "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77", + "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d", + "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0", + "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed", + "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068", + "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac", + "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25", + "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8", + "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab", + "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26", + "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2", + "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db", + "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f", + "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5", + "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99", + "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c", + "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d", + "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811", + "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa", + "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a", + "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03", + "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b", + "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04", + "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c", + "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001", + "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458", + "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389", + "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99", + "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985", + "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537", + "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238", + "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f", + "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d", + "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796", + "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a", + "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143", + "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8", + "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c", + "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5", + "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5", + "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711", + "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4", + "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6", + "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c", + "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7", + "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4", + "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b", + "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae", + "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12", + "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c", + "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae", + "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8", + "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887", + "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b", + "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4", + "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f", + "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5", + "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33", + "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519", + "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561" ], "markers": "python_full_version >= '3.7.0'", - "version": "==3.3.0" + "version": "==3.3.2" }, "click": { "hashes": [ @@ -339,33 +339,49 @@ }, "cryptography": { "hashes": [ - "sha256:004b6ccc95943f6a9ad3142cfabcc769d7ee38a3f60fb0dddbfb431f818c3a67", - "sha256:047c4603aeb4bbd8db2756e38f5b8bd7e94318c047cfe4efeb5d715e08b49311", - "sha256:0d9409894f495d465fe6fda92cb70e8323e9648af912d5b9141d616df40a87b8", - "sha256:23a25c09dfd0d9f28da2352503b23e086f8e78096b9fd585d1d14eca01613e13", - "sha256:2ed09183922d66c4ec5fdaa59b4d14e105c084dd0febd27452de8f6f74704143", - "sha256:35c00f637cd0b9d5b6c6bd11b6c3359194a8eba9c46d4e875a3660e3b400005f", - "sha256:37480760ae08065437e6573d14be973112c9e6dcaf5f11d00147ee74f37a3829", - "sha256:3b224890962a2d7b57cf5eeb16ccaafba6083f7b811829f00476309bce2fe0fd", - "sha256:5a0f09cefded00e648a127048119f77bc2b2ec61e736660b5789e638f43cc397", - "sha256:5b72205a360f3b6176485a333256b9bcd48700fc755fef51c8e7e67c4b63e3ac", - "sha256:7e53db173370dea832190870e975a1e09c86a879b613948f09eb49324218c14d", - "sha256:7febc3094125fc126a7f6fb1f420d0da639f3f32cb15c8ff0dc3997c4549f51a", - "sha256:80907d3faa55dc5434a16579952ac6da800935cd98d14dbd62f6f042c7f5e839", - "sha256:86defa8d248c3fa029da68ce61fe735432b047e32179883bdb1e79ed9bb8195e", - "sha256:8ac4f9ead4bbd0bc8ab2d318f97d85147167a488be0e08814a37eb2f439d5cf6", - "sha256:93530900d14c37a46ce3d6c9e6fd35dbe5f5601bf6b3a5c325c7bffc030344d9", - "sha256:9eeb77214afae972a00dee47382d2591abe77bdae166bda672fb1e24702a3860", - "sha256:b5f4dfe950ff0479f1f00eda09c18798d4f49b98f4e2006d644b3301682ebdca", - "sha256:c3391bd8e6de35f6f1140e50aaeb3e2b3d6a9012536ca23ab0d9c35ec18c8a91", - "sha256:c880eba5175f4307129784eca96f4e70b88e57aa3f680aeba3bab0e980b0f37d", - "sha256:cecfefa17042941f94ab54f769c8ce0fe14beff2694e9ac684176a2535bf9714", - "sha256:e40211b4923ba5a6dc9769eab704bdb3fbb58d56c5b336d30996c24fcf12aadb", - "sha256:efc8ad4e6fc4f1752ebfb58aefece8b4e3c4cae940b0994d43649bdfce8d0d4f" + "sha256:02c0eee2d7133bdbbc5e24441258d5d2244beb31da5ed19fbb80315f4bbbff55", + "sha256:0d563795db98b4cd57742a78a288cdbdc9daedac29f2239793071fe114f13785", + "sha256:16268d46086bb8ad5bf0a2b5544d8a9ed87a0e33f5e77dd3c3301e63d941a83b", + "sha256:1a58839984d9cb34c855197043eaae2c187d930ca6d644612843b4fe8513c886", + "sha256:2954fccea107026512b15afb4aa664a5640cd0af630e2ee3962f2602693f0c82", + "sha256:2e47577f9b18723fa294b0ea9a17d5e53a227867a0a4904a1a076d1646d45ca1", + "sha256:31adb7d06fe4383226c3e963471f6837742889b3c4caa55aac20ad951bc8ffda", + "sha256:3577d029bc3f4827dd5bf8bf7710cac13527b470bbf1820a3f394adb38ed7d5f", + "sha256:36017400817987670037fbb0324d71489b6ead6231c9604f8fc1f7d008087c68", + "sha256:362e7197754c231797ec45ee081f3088a27a47c6c01eff2ac83f60f85a50fe60", + "sha256:3de9a45d3b2b7d8088c3fbf1ed4395dfeff79d07842217b38df14ef09ce1d8d7", + "sha256:4f698edacf9c9e0371112792558d2f705b5645076cc0aaae02f816a0171770fd", + "sha256:5482e789294854c28237bba77c4c83be698be740e31a3ae5e879ee5444166582", + "sha256:5e44507bf8d14b36b8389b226665d597bc0f18ea035d75b4e53c7b1ea84583cc", + "sha256:779245e13b9a6638df14641d029add5dc17edbef6ec915688f3acb9e720a5858", + "sha256:789caea816c6704f63f6241a519bfa347f72fbd67ba28d04636b7c6b7da94b0b", + "sha256:7f8b25fa616d8b846aef64b15c606bb0828dbc35faf90566eb139aa9cff67af2", + "sha256:8cb8ce7c3347fcf9446f201dc30e2d5a3c898d009126010cbd1f443f28b52678", + "sha256:93a3209f6bb2b33e725ed08ee0991b92976dfdcf4e8b38646540674fc7508e13", + "sha256:a3a5ac8b56fe37f3125e5b72b61dcde43283e5370827f5233893d461b7360cd4", + "sha256:a47787a5e3649008a1102d3df55424e86606c9bae6fb77ac59afe06d234605f8", + "sha256:a79165431551042cc9d1d90e6145d5d0d3ab0f2d66326c201d9b0e7f5bf43604", + "sha256:a987f840718078212fdf4504d0fd4c6effe34a7e4740378e59d47696e8dfb477", + "sha256:a9bc127cdc4ecf87a5ea22a2556cab6c7eda2923f84e4f3cc588e8470ce4e42e", + "sha256:bd13b5e9b543532453de08bcdc3cc7cebec6f9883e886fd20a92f26940fd3e7a", + "sha256:c65f96dad14f8528a447414125e1fc8feb2ad5a272b8f68477abbcc1ea7d94b9", + "sha256:d8e3098721b84392ee45af2dd554c947c32cc52f862b6a3ae982dbb90f577f14", + "sha256:e6b79d0adb01aae87e8a44c2b64bc3f3fe59515280e00fb6d57a7267a2583cda", + "sha256:e6b8f1881dac458c34778d0a424ae5769de30544fc678eac51c1c8bb2183e9da", + "sha256:e9b2a6309f14c0497f348d08a065d52f3020656f675819fc405fb63bbcd26562", + "sha256:ecbfbc00bf55888edda9868a4cf927205de8499e7fabe6c050322298382953f2", + "sha256:efd0bf5205240182e0f13bcaea41be4fdf5c22c5129fc7ced4a0282ac86998c9" ], "index": "pypi", "markers": "python_version >= '3.7'", - "version": "==41.0.4" + "version": "==42.0.7" + }, + "deprecation": { + "hashes": [ + "sha256:72b3bde64e5d778694b0cf68178aed03d15e15477116add3fb773e581f9518ff", + "sha256:a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a" + ], + "version": "==2.1.0" }, "ecdsa": { "hashes": [ @@ -584,11 +600,11 @@ }, "idna": { "hashes": [ - "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", - "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f" + "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc", + "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0" ], "markers": "python_version >= '3.5'", - "version": "==3.6" + "version": "==3.7" }, "importlib-metadata": { "hashes": [ @@ -807,6 +823,14 @@ "markers": "python_version >= '3.7'", "version": "==3.1.6" }, + "packaging": { + "hashes": [ + "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", + "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9" + ], + "markers": "python_version >= '3.7'", + "version": "==24.0" + }, "protobuf": { "hashes": [ "sha256:02212557a76cd99574775a81fefeba8738d0f668d6abd0c6b1d3adcc75503dbe", @@ -844,10 +868,11 @@ }, "pycparser": { "hashes": [ - "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9", - "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206" + "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6", + "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc" ], - "version": "==2.21" + "markers": "python_version >= '3.8'", + "version": "==2.22" }, "pycryptodomex": { "hashes": [ @@ -939,6 +964,15 @@ ], "version": "==3.3.0" }, + "python-keycloak": { + "hashes": [ + "sha256:4c2cd580ded92326b74a376fe453519b3a6db019803032cae26a4b9099e1afd0", + "sha256:ce6a33af5840469e71090b8f556b67488561c723693f3581396ed088bce0665a" + ], + "index": "pypi", + "markers": "python_version >= '3.8' and python_version < '4.0'", + "version": "==3.9.0" + }, "pytz": { "hashes": [ "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b", @@ -1019,6 +1053,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.3.1" }, + "requests-toolbelt": { + "hashes": [ + "sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6", + "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.0.0" + }, "rsa": { "hashes": [ "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7", @@ -1073,7 +1115,6 @@ "sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07", "sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0" ], - "index": "pypi", "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", "version": "==1.26.18" }, From 074220679f33d748d72e843271bf83ce20e6f7ee Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sun, 19 May 2024 22:53:33 +0800 Subject: [PATCH 02/10] Add Keycloak integration This integration allows Github Team Sync to pull group data from Keycloak via its admin REST API. Users can choose to do a username sync as normal, or they can link to an existing Github account by enabling KEYCLOAK_USE_GITHUB_IDP. This requires the user to add Github as an Identity provider on the user's realm. --- .env.example.keycloak | 89 +++++++++++++++++++++++++++++ githubapp/__init__.py | 2 + githubapp/keycloak.py | 127 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 .env.example.keycloak create mode 100644 githubapp/keycloak.py diff --git a/.env.example.keycloak b/.env.example.keycloak new file mode 100644 index 0000000..c9f8484 --- /dev/null +++ b/.env.example.keycloak @@ -0,0 +1,89 @@ +######################### +## GitHub App Settings ## +######################### +## Webhook Secret +WEBHOOK_SECRET=development +## GitHub App ID +APP_ID=12345 +## Private Key Path +PRIVATE_KEY_PATH=.ssh/team-sync.pem +## Uncomment the following line and use your own GitHub Enterprise +## instance if this will not be used on https://github.com +#GHE_HOST=github.example.com +## Uncomment if you are using a self-signed certificate on GitHub Enterprise. +## Defaults to False. +#VERIFY_SSL=False + +## User directory to sync GitHub teams from +## Azure AD = AAD +## Active Directory = LDAP +## OpenLDAP = LDAP +## Okta = OKTA +## Keycloak = KEYCLOAK +USER_DIRECTORY=KEYCLOAK +## Attribute to compare users with +## username or email +USER_SYNC_ATTRIBUTE=username + + +################### +## Keycloak Settings ## +################### +## Your organizations Okta URL +KEYCLOAK_SERVER_URL=https://example.okta.com + +############################### +## Keycloak authentication ## +############################### +## Keycloak account credentials +## This account needs to have access to the master (or equivalent) realm +## as it will be using the Admin API +KEYCLOAK_USERNAME=api-account +KEYCLOAK_PASSWORD=ExamplePassword +## Master (or equivalent) realm name +#KEYCLOAK_MASTER_REALM=master +## Realm where users are stored +#KEYCLOAK_USER_REALM=master +## Use the Github Identity Provider within Keycloak? +## This requires you to set up the provider as an Identity provider with +## the user realm +#KEYCLOAK_USE_GITHUB_IDP=true + +######################### +## Additional settings ## +######################### +## Stop if number of changes exceeds this number +## Default: 25 +#CHANGE_THRESHOLD=25 +## Create an issue if the sync fails for any reason +## Default: false +#OPEN_ISSUE_ON_FAILURE=true +## Where to open the issue upon sync failure +#REPO_FOR_ISSUES=github-demo/demo-repo +## Who to assign the issues to +#ISSUE_ASSIGNEE=githubber +## Sync schedule, cron style schedule +## Shortcode for emu accounts +#EMU_SHORTCODE=volcano + +## Default (hourly): 0 * * * * +SYNC_SCHEDULE=0 * * * * +## Show the changes, but do not make any changes +## Default: false +#TEST_MODE=false +## Automatically add users missing from the organization +ADD_MEMBER=false +## Automatically remove users from the organisation that are not part of a team +REMOVE_ORG_MEMBERS_WITHOUT_TEAM=false + +#################### +## Flask Settings ## +#################### +## Default: app +FLASK_APP=app +## Default: production +FLASK_ENV=development +## Default: 5000 +FLASK_RUN_PORT=5000 +## Default: 127.0.0.1 +FLASK_RUN_HOST=0.0.0.0 diff --git a/githubapp/__init__.py b/githubapp/__init__.py index a4006dd..84d9de9 100644 --- a/githubapp/__init__.py +++ b/githubapp/__init__.py @@ -13,6 +13,8 @@ from .onelogin import OneLogin as DirectoryClient elif os.environ.get("USER_DIRECTORY", "LDAP").upper() == "GOOGLE_WORKSPACE": from .googleworkspace import GoogleWorkspaceClient as DirectoryClient +elif os.environ.get("USER_DIRECTORY", "LDAP").upper() == "KEYCLOAK": + from .keycloak import Keycloak as DirectoryClient from .version import __version__ __all__ = ["GitHubApp", "DirectoryClient"] diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py new file mode 100644 index 0000000..8de8454 --- /dev/null +++ b/githubapp/keycloak.py @@ -0,0 +1,127 @@ +import asyncio +import collections +import os +import logging +import re +from keycloak import KeycloakAdmin + + +LOG = logging.getLogger(__name__) + + +class Keycloak: + def __init__(self): + if not os.environ.get("KEYCLOAK_SERVER_URL", None): + raise Exception("KEYCLOAK_SERVER_URL not defined") + + if not os.environ.get("KEYCLOAK_USERNAME", None): + raise Exception("KEYCLOAK_USERNAME not defined") + + if not os.environ.get("KEYCLOAK_PASSWORD", None): + raise Exception("KEYCLOAK_PASSWORD not defined") + + self.UseGithubIDP = os.environ.get("KEYCLOAK_USE_GITHUB_IDP", "true") == "true" + + self.client = KeycloakAdmin( + server_url=os.environ["KEYCLOAK_SERVER_URL"], + username=os.environ["KEYCLOAK_USERNAME"], + password=os.environ["KEYCLOAK_PASSWORD"], + realm_name=os.environ.get("KEYCLOAK_MASTER_REALM", "master"), + user_realm_name=os.environ.get("KEYCLOAK_USER_REALM", "master") + ) + + def get_group_members(self, group_name: str = None): + """ + Get a list of users that are in a group in Keycloak + + :param group_name: Group name to look up + :type group_name: str + + :return member_list: A list of dictionaries containing usernames and emails + :rtype member_list: list + """ + member_list = [] + + def get_group_id(client: KeycloakAdmin = None): + """ + Get the UUID of the provided group from Keycloak + + :param client: A KeycloakAdmin client + + :return: The group's UUID in Keycloak + """ + group = client.get_groups(query={"search": group_name}) + return group[0]["id"] + + def get_members(client: KeycloakAdmin = None, group_id: str = None): + """ + Get the users that are in this group + + :param client: A KeycloakAdmin client + :param group_id: The group's UUID in Keycloak + + :return: A list containing all users in the group + """ + # Keycloak paginates the response when grabbing the list of members + # The response doesn't contain any info on the next page either + # Therefore, we'll need to iterate over the pages until the returned + # list is smaller than the provided page size + page_start = 1 + page_size = 100 + members = None + group_members = client.get_group_members( + group_id=group_id, + query={"first": page_start, "max": page_size} + ) + members += group_members + while len(group_members) == page_size: + page_start += page_size + group_members = client.get_group_members( + group_id=group_id, + query={"first": page_start, "max": page_size} + ) + members += group_members + return members + + def get_github_username(client: KeycloakAdmin = None, user_id: str = None): + """ + Gets the GitHub username from the user's Keycloak profile + This only works if the Keycloak realm has GitHub set up + as an Identity provider. + + :param client: A KeycloakAdmin client + :param user_id: The user's UUID in Keycloak + + :return: The user's GitHub username + """ + profile = client.get_user(user_id=user_id) + github_username = None + for provider in profile["federatedIdentities"]: + if provider["identityProvider"] == "github": + github_username = provider["userName"] + if not github_username: + raise Exception("Cannot find Github username") + return github_username + + gid = get_group_id(client=self.client) + users: collections.Iterable = get_members(client=self.client, group_id=gid) + for user in users: + try: + if self.UseGithubIDP: + username = get_github_username(client=self.client, user_id=user["id"]) + else: + username = user["username"] + if not username: + raise Exception("Unable to find username in profile") + if "EMU_SHORTCODE" in os.environ: + username = username + "_" + os.environ["EMU_SHORTCODE"] + member_list.append( + { + "username": username, + "email": user["email"] + } + ) + except Exception as e: + user_info = f'{user["username"]} ({user["email"]})' + print(f"User {user_info}: {e}") + return member_list From 73ff5d162fc2fab11a077b24d3484aca5b2f9122 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Mon, 20 May 2024 13:46:57 +0800 Subject: [PATCH 03/10] Add documentation for Keycloak --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 39d179f..b8d349f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ It supports both GitHub.com, GitHub Enterprise Server (GHES) and GitHub, but it - Okta - OneLogin - Google Workspace +- Keycloak ## Features This utility provides the following functionality: @@ -73,6 +74,10 @@ This app requires the following Azure permissions: - `GroupMember.Read.All` - `User.Read.All` +#### Keycloak Permissions +If you have `ADMIN_FINE_GRAINED_AUTHZ` enabled, you only need the following permission for the user realm: +- `view-users` + ## Getting Started To get started, ensure that you are using **Python 3.9** (or update your `Pipfile` to the version you're running, 3.4+). The following additional libraries are required: @@ -86,6 +91,7 @@ To get started, ensure that you are using **Python 3.9** (or update your `Pipfil - [ ] asyncio - [ ] okta - [ ] onelogin +- [ ] python-keycloak Install the required libraries. @@ -181,6 +187,15 @@ OKTA_SCOPES='okta.users.read okta.groups.read' OKTA_PRIVATE_KEY='{"kty": "RSA", ...}' ``` +### Sample `.env` for Keycloak +```env +KEYCLOAK_USERNAME=api-account +KEYCLOAK_PASSWORD=ExamplePassword +KEYCLOAK_MASTER_REALM=master +KEYCLOAK_USER_REALM=ExampleCorp +KEYCLOAK_USE_GITHUB_IDP=true +``` + ### Sample `.env` for OneLogin ```env ONELOGIN_CLIENT_ID='asdafsflkjlk13q33433445wee' From 4f1ea2923f5b5e4ff5676e38cb9db50deeb8fe44 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sat, 25 May 2024 11:46:22 +0800 Subject: [PATCH 04/10] Keycloak: define `members` as empty list Defining members as None then adding group members to it appears to work in newer Python versions. However, this results in a TypeError in 3.9. Changing this to define an empty list from the outset works better, and I probably should've done that to begin with --- githubapp/keycloak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index 8de8454..20cbc10 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -68,7 +68,7 @@ def get_members(client: KeycloakAdmin = None, group_id: str = None): # list is smaller than the provided page size page_start = 1 page_size = 100 - members = None + members = [] group_members = client.get_group_members( group_id=group_id, query={"first": page_start, "max": page_size} From 4554b7af6fcf09497403ac7abc6a575803d3acdd Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Mon, 27 May 2024 18:49:56 +0800 Subject: [PATCH 05/10] Keycloak: do exact search for group --- githubapp/keycloak.py | 1 + 1 file changed, 1 insertion(+) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index 20cbc10..f397b7c 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -51,6 +51,7 @@ def get_group_id(client: KeycloakAdmin = None): :return: The group's UUID in Keycloak """ group = client.get_groups(query={"search": group_name}) + group = client.get_groups(query={"search": group_name, "briefRepresentation": "true", "exact": "true"}) return group[0]["id"] def get_members(client: KeycloakAdmin = None, group_id: str = None): From a44359a7028ccce95b43063d977bc5db6452e00f Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Tue, 28 May 2024 20:21:24 +0800 Subject: [PATCH 06/10] Keycloak: raise Exception if group isn't found --- githubapp/keycloak.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index f397b7c..8dac12e 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -50,9 +50,12 @@ def get_group_id(client: KeycloakAdmin = None): :return: The group's UUID in Keycloak """ - group = client.get_groups(query={"search": group_name}) + group = client.get_groups(query={"search": group_name, "briefRepresentation": "true", "exact": "true"}) - return group[0]["id"] + if not group: + raise Exception(f"Cannot find group {group_name} in Keycloak") + else: + return group[0]["id"] def get_members(client: KeycloakAdmin = None, group_id: str = None): """ From 13b6e7c7c8adcff248969f123ede40fa04c5f465 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Tue, 28 May 2024 21:01:59 +0800 Subject: [PATCH 07/10] Keycloak: clarify settings for realms --- .env.example.keycloak | 10 +++++++--- README.md | 4 ++-- githubapp/keycloak.py | 7 +++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.env.example.keycloak b/.env.example.keycloak index c9f8484..5c2bc48 100644 --- a/.env.example.keycloak +++ b/.env.example.keycloak @@ -40,10 +40,14 @@ KEYCLOAK_SERVER_URL=https://example.okta.com ## as it will be using the Admin API KEYCLOAK_USERNAME=api-account KEYCLOAK_PASSWORD=ExamplePassword -## Master (or equivalent) realm name -#KEYCLOAK_MASTER_REALM=master ## Realm where users are stored -#KEYCLOAK_USER_REALM=master +## Default: master +#KEYCLOAK_REALM=master +## Realm where the API account is stored +## Only required if the account is stored in a different realm than your +## users are in +## Default: same as KEYCLOAK_REALM +#KEYCLOAK_ADMIN_REALM=master ## Use the Github Identity Provider within Keycloak? ## This requires you to set up the provider as an Identity provider with ## the user realm diff --git a/README.md b/README.md index b8d349f..190db7d 100644 --- a/README.md +++ b/README.md @@ -191,8 +191,8 @@ OKTA_PRIVATE_KEY='{"kty": "RSA", ...}' ```env KEYCLOAK_USERNAME=api-account KEYCLOAK_PASSWORD=ExamplePassword -KEYCLOAK_MASTER_REALM=master -KEYCLOAK_USER_REALM=ExampleCorp +KEYCLOAK_REALM=ExampleCorp +KEYCLOAK_ADMIN_REALM=master KEYCLOAK_USE_GITHUB_IDP=true ``` diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index 8dac12e..30130ee 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -20,14 +20,17 @@ def __init__(self): if not os.environ.get("KEYCLOAK_PASSWORD", None): raise Exception("KEYCLOAK_PASSWORD not defined") + if not os.environ.get("KEYCLOAK_ADMIN_REALM"): + os.environ["KEYCLOAK_ADMIN_REALM"] = os.environ.get("KEYCLOAK_REALM") + self.UseGithubIDP = os.environ.get("KEYCLOAK_USE_GITHUB_IDP", "true") == "true" self.client = KeycloakAdmin( server_url=os.environ["KEYCLOAK_SERVER_URL"], username=os.environ["KEYCLOAK_USERNAME"], password=os.environ["KEYCLOAK_PASSWORD"], - realm_name=os.environ.get("KEYCLOAK_MASTER_REALM", "master"), - user_realm_name=os.environ.get("KEYCLOAK_USER_REALM", "master") + realm_name=os.environ.get("KEYCLOAK_REALM", "master"), + user_realm_name=os.environ.get("KEYCLOAK_ADMIN_REALM", "master") ) def get_group_members(self, group_name: str = None): From d7e3060e4d1941beb34d369f8c3724abd029aa89 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sat, 1 Jun 2024 21:16:47 +0800 Subject: [PATCH 08/10] Keycloak: fix default realm handling --- githubapp/keycloak.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index 30130ee..f839e2e 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -20,6 +20,9 @@ def __init__(self): if not os.environ.get("KEYCLOAK_PASSWORD", None): raise Exception("KEYCLOAK_PASSWORD not defined") + if not os.environ.get("KEYCLOAK_REALM"): + os.environ["KEYCLOAK_REALM"] = "master" + if not os.environ.get("KEYCLOAK_ADMIN_REALM"): os.environ["KEYCLOAK_ADMIN_REALM"] = os.environ.get("KEYCLOAK_REALM") @@ -29,8 +32,8 @@ def __init__(self): server_url=os.environ["KEYCLOAK_SERVER_URL"], username=os.environ["KEYCLOAK_USERNAME"], password=os.environ["KEYCLOAK_PASSWORD"], - realm_name=os.environ.get("KEYCLOAK_REALM", "master"), - user_realm_name=os.environ.get("KEYCLOAK_ADMIN_REALM", "master") + realm_name=os.environ["KEYCLOAK_REALM"], + user_realm_name=os.environ.get["KEYCLOAK_ADMIN_REALM"] ) def get_group_members(self, group_name: str = None): From 22639ae89e67ba0fe5a4b5b34db3e5c86a42e3d9 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sat, 1 Jun 2024 21:24:20 +0800 Subject: [PATCH 09/10] Fix bug (also fix commit history later) --- githubapp/keycloak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index f839e2e..bcf93cc 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -33,7 +33,7 @@ def __init__(self): username=os.environ["KEYCLOAK_USERNAME"], password=os.environ["KEYCLOAK_PASSWORD"], realm_name=os.environ["KEYCLOAK_REALM"], - user_realm_name=os.environ.get["KEYCLOAK_ADMIN_REALM"] + user_realm_name=os.environ["KEYCLOAK_ADMIN_REALM"] ) def get_group_members(self, group_name: str = None): From 11bb4207facfba53766f8614e28d05bd303cf901 Mon Sep 17 00:00:00 2001 From: Ike Johnson-Woods Date: Sun, 9 Jun 2024 11:55:05 +0800 Subject: [PATCH 10/10] Keycloak: Start page_start at 0 Turns out, you need to start your page at 0 to get all users! How could this have happened! --- githubapp/keycloak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubapp/keycloak.py b/githubapp/keycloak.py index bcf93cc..85dbfb4 100644 --- a/githubapp/keycloak.py +++ b/githubapp/keycloak.py @@ -76,7 +76,7 @@ def get_members(client: KeycloakAdmin = None, group_id: str = None): # The response doesn't contain any info on the next page either # Therefore, we'll need to iterate over the pages until the returned # list is smaller than the provided page size - page_start = 1 + page_start = 0 page_size = 100 members = [] group_members = client.get_group_members(