-
Notifications
You must be signed in to change notification settings - Fork 134
docs:Added documentation of Keyring Feature #2612
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
Changes from 1 commit
11bf783
b4d5318
4566280
db10a04
b111828
80911b9
4aad38c
9d6b164
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -398,7 +398,130 @@ Common resources that a test might need, | |
| like e.g. a running MSColab server or a QApplication instance for GUI tests, | ||
| are collected in :mod:`tests.fixtures` in the form of pytest fixtures that can be requested as needed in tests. | ||
|
|
||
| Testing Keyring Features | ||
| ======================== | ||
|
anj20 marked this conversation as resolved.
Outdated
|
||
|
|
||
| This document provides step-by-step instructions for testing keyring features using both the command line and Python scripts. | ||
|
|
||
| Prerequisites | ||
| ------------- | ||
|
|
||
| 1. **Confirm the Default Keyring Backend** | ||
|
|
||
| Use the following command to list available keyring backends and check which one is currently in use: | ||
| :: | ||
|
|
||
| keyring --list-backends | ||
|
|
||
| Command-Line Commands for Keyring | ||
| --------------------------------- | ||
|
|
||
| 1. **Set a Password** | ||
|
|
||
| Store a password for a specific service and user: | ||
| :: | ||
|
|
||
| keyring set SERVICE_NAME USERNAME | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the examples maybe should destinguish the http_auth protection and a user password.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the WMS Servers this username can differ for each server, an example is given in config.py
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mscolab has besides the common http_auth also user accounts and they are not described here. These can become tested when you add a user with a password to your local running server.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an example here would be keyring set http://localhost:8083 myname@mydomain Then when you started mscolab and use the myname@mydomain for this url it fills in your saved credentials and you are logged in by login. |
||
|
|
||
| **Example:** | ||
| :: | ||
|
|
||
| keyring set msui [email protected] | ||
|
|
||
| - The command will securely prompt you to input a password (e.g., `example_password`). | ||
|
|
||
| 2. **Get a Password** | ||
|
|
||
| Retrieve the stored password for a service and user: | ||
| :: | ||
|
|
||
| keyring get SERVICE_NAME USERNAME | ||
|
|
||
| **Example:** | ||
| :: | ||
|
|
||
| keyring get msui [email protected] | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is again mixed two cases. here you would do an example
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and for the case of an http_auth
|
||
| **Output:** | ||
| :: | ||
|
|
||
| example_password | ||
|
|
||
| 3. **Delete a Password** | ||
|
|
||
| Remove the stored password for a service and user: | ||
| :: | ||
|
|
||
| keyring delete SERVICE_NAME USERNAME | ||
|
|
||
| **Example:** | ||
| :: | ||
|
|
||
| keyring delete msui [email protected] | ||
|
|
||
| To confirm the deletion, attempt to retrieve the password: | ||
| :: | ||
|
|
||
| keyring get msui [email protected] | ||
|
|
||
| If the password has been deleted, you’ll see an error message such as: | ||
| :: | ||
|
|
||
| No password found for 'msui' and '[email protected]'. | ||
|
|
||
| Python Script for Keyring Automation | ||
| ------------------------------------ | ||
|
|
||
| 1. **Set a Password** | ||
|
|
||
| Store a password for a specific service and user: | ||
| :: | ||
|
|
||
| import keyring | ||
|
|
||
| keyring.set_password("msui", "[email protected]", "example_password") | ||
|
|
||
| 2. **Retrieve the Password** | ||
|
|
||
| Retrieve the stored password: | ||
| :: | ||
|
|
||
| import keyring | ||
|
|
||
| print(keyring.get_password("msui", "[email protected]")) # Output: example_password | ||
|
|
||
| 3. **Delete a Password** | ||
|
|
||
| Delete the stored password: | ||
| :: | ||
|
|
||
| import keyring | ||
|
|
||
| keyring.delete_password("msui", "[email protected]") | ||
|
|
||
| 4. **Verify Deletion** | ||
|
|
||
| Attempt to retrieve the deleted password: | ||
| :: | ||
|
|
||
| import keyring | ||
|
|
||
| print(keyring.get_password("msui", "[email protected]")) # Output: None or error | ||
|
|
||
| Examples of Usage in Command Line | ||
| --------------------------------- | ||
|
|
||
| :: | ||
|
|
||
| # Set a password | ||
| keyring set my_service my_user | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixed again we should have in the docs something a developer can use for the application. This is also usefull when you have a new computer and want to transfer account data. |
||
| # Get the password | ||
| keyring get my_service my_user | ||
|
|
||
| # Delete the password | ||
| keyring delete my_service my_user | ||
|
|
||
| Changing the database model | ||
| --------------------------- | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can name it
Keyring Features
testing has some different meaning