-
Notifications
You must be signed in to change notification settings - Fork 2
fix: issue and latest version pre-release #90
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
Open
FortiShield
wants to merge
6
commits into
khulnasoft:master
Choose a base branch
from
FortiShield:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aafaefe
fix: issue and latest version pre-release
20b64bf
feat: pre-release add
gitworkflows f986504
Update README.md
khulnasoft-bot 72485f0
Update src/aideck/services/user.py
khulnasoft-bot d89cdc4
Update src/aideck/models/user.py
khulnasoft-bot cf825b0
Update .github/ISSUE_TEMPLATE/question.yml
khulnasoft-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,119 @@ | ||
| # Authentication System | ||
|
|
||
| This document provides an overview of the authentication system implemented in the GPT Computer Agent. | ||
|
|
||
| ## Features | ||
|
|
||
| - JWT-based authentication | ||
| - User registration and login | ||
| - Password hashing with bcrypt | ||
| - Role-based access control (RBAC) | ||
| - Refresh token support | ||
| - Secure password reset flow | ||
| - API key authentication for programmatic access | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Install the required dependencies: | ||
|
|
||
| ```bash | ||
| pip install python-jose[cryptography] passlib[bcrypt] python-multipart | ||
| ``` | ||
|
|
||
| 2. Set up your environment variables in `.env`: | ||
|
|
||
| ```env | ||
| # Authentication | ||
| SECRET_KEY=your-secret-key-here | ||
| ACCESS_TOKEN_EXPIRE_MINUTES=1440 # 24 hours | ||
| REFRESH_TOKEN_EXPIRE_DAYS=30 | ||
| JWT_ALGORITHM=HS256 | ||
| JWT_ISSUER=gpt-computer-agent | ||
|
|
||
| # First superuser (created on first run if no users exist) | ||
| FIRST_SUPERUSER=admin@example.com | ||
| FIRST_SUPERUSER_PASSWORD=changeme | ||
| ``` | ||
|
|
||
| 3. Run the database migrations: | ||
|
|
||
| ```bash | ||
| alembic upgrade head | ||
| ``` | ||
|
|
||
| ## API Endpoints | ||
|
|
||
| ### Authentication | ||
|
|
||
| - `POST /api/auth/register` - Register a new user | ||
| - `POST /api/auth/token` - Login and get access token | ||
| - `POST /api/auth/refresh` - Refresh access token | ||
| - `POST /api/auth/forgot-password` - Request password reset | ||
| - `POST /api/auth/reset-password` - Reset password with token | ||
|
|
||
| ### Users | ||
|
|
||
| - `GET /api/users/me` - Get current user info | ||
| - `PUT /api/users/me` - Update current user | ||
| - `GET /api/users/` - List all users (admin only) | ||
| - `GET /api/users/{user_id}` - Get user by ID | ||
| - `PUT /api/users/{user_id}` - Update user (admin or self) | ||
| - `DELETE /api/users/{user_id}` - Delete user (admin only) | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Register a new user | ||
|
|
||
| ```bash | ||
| curl -X 'POST' \ | ||
| 'http://localhost:8000/api/auth/register' \ | ||
| -H 'accept: application/json' \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
| "email": "user@example.com", | ||
| "username": "user", | ||
| "password": "string", | ||
| "full_name": "string" | ||
| }' | ||
| ``` | ||
|
|
||
| ### Login | ||
|
|
||
| ```bash | ||
| curl -X 'POST' \ | ||
| 'http://localhost:8000/api/auth/token' \ | ||
| -H 'accept: application/json' \ | ||
| -H 'Content-Type: application/x-www-form-urlencoded' \ | ||
| -d 'grant_type=&username=user%40example.com&password=string&scope=&client_id=&client_secret=' | ||
| ``` | ||
|
|
||
| ### Make authenticated request | ||
|
|
||
| ```bash | ||
| curl -X 'GET' \ | ||
| 'http://localhost:8000/api/users/me' \ | ||
| -H 'accept: application/json' \ | ||
| -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' | ||
| ``` | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| - Always use HTTPS in production | ||
| - Store secrets in environment variables, never in code | ||
| - Set appropriate CORS policies | ||
| - Implement rate limiting | ||
| - Use secure, random secret keys | ||
| - Keep dependencies updated | ||
| - Regularly rotate secrets | ||
|
|
||
| ## Testing | ||
|
|
||
| To run the test suite: | ||
|
|
||
| ```bash | ||
| pytest tests/ | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| This authentication system is part of the GPT Computer Agent project and is licensed under the MIT License. |
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.