-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from passageidentity/PSG-3833-new-auth-methods
Added support for WebAuthn Authenticator Attachments
- Loading branch information
Showing
69 changed files
with
2,563 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
|
||
# Define a list of tuples for replacements where each tuple is ('file_path', 'old_text', 'new_text') | ||
replacements = [ | ||
|
||
# Authenticator attachment "cross-platform" gets misleading name "crossMinusPlatform": | ||
( | ||
'./generated/src/main/kotlin/id/passage/android/model/AuthenticatorAttachment.kt', | ||
'crossMinusPlatform', | ||
'crossPlatform' | ||
), | ||
|
||
# appleOauth2Callback functions wrongfully assume "error" is NOT null: | ||
( | ||
'./generated/src/main/kotlin/id/passage/android/api/OAuth2API.kt', | ||
'"error" to PartConfig(body = error.value, headers = mutableMapOf())', | ||
'"error" to PartConfig(body = error?.value, headers = mutableMapOf())' | ||
), | ||
|
||
# User model requires `webauthn_types` property, but webauthn start returns user WITHOUT it, so we must make it optional. | ||
( | ||
'./generated/src/main/kotlin/id/passage/android/model/User.kt', | ||
'val webauthnTypes: kotlin.collections.List<WebAuthnType>', | ||
'val webauthnTypes: kotlin.collections.List<WebAuthnType>?' | ||
), | ||
|
||
# Add more replacements here as needed | ||
# ('oldText', 'newText'), | ||
] | ||
|
||
def replace_in_file(replacement): | ||
file_path, old_text, new_text = replacement | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
content = file.read() | ||
|
||
updated_content = content | ||
# for old_text, new_text in replacements: | ||
updated_content = updated_content.replace(old_text, new_text) | ||
|
||
if content != updated_content: | ||
with open(file_path, 'w', encoding='utf-8') as file: | ||
file.write(updated_content) | ||
print(f"Updated {file_path}") | ||
|
||
for replacement in replacements: | ||
replace_in_file(replacement) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.