
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
A robust authentication package for FastAPI applications that provides JWT token management, user authentication, and middleware functionality.
pip install abs-auth-core
from fastapi import FastAPI, Depends
from abs_auth_core import AuthFunctions, JWTFunctions
from sqlalchemy.orm import Session
app = FastAPI()
# Initialize JWT functions
jwt_functions = JWTFunctions(
secret_key="your-secret-key",
algorithm="HS256",
expire_minutes=30
)
# Initialize Auth functions with your database session and User model
auth_functions = AuthFunctions(
db_session=lambda: Session(),
User=YourUserModel
)
from abs_auth_core import auth_middleware
# Create the authentication middleware
auth = auth_middleware(
db_session=lambda: Session(),
Users=YourUserModel,
jwt_secret_key="your-secret-key",
jwt_algorithm="HS256"
)
# Use the middleware in your routes
@app.get("/protected")
async def protected_route(user = Depends(auth)):
return {"message": f"Hello, {user.username}!"}
# Generate access and refresh tokens
tokens = jwt_functions.generate_tokens(
data={"sub": "user123"},
user_id=1,
db=lambda: Session(),
User=YourUserModel
)
# The tokens dictionary contains:
# {
# "access_token": "...",
# "refresh_token": "...",
# "token_type": "bearer"
# }
# Hash a password
hashed_password = jwt_functions.get_password_hash("user_password")
# Verify a password
is_valid = jwt_functions.verify_password("user_password", hashed_password)
# Get user by attribute
user = auth_functions.get_user_by_attribute("email", "user@example.com")
## Security Features
- Secure password hashing using bcrypt
- JWT token expiration
- Refresh token rotation
- Exception handling for authentication failures
## Best Practices
1. Always use HTTPS in production
2. Store sensitive configuration (secret keys, etc.) in environment variables
3. Implement proper error handling
4. Use appropriate token expiration times
5. Implement rate limiting for authentication endpoints
## License
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Authentication core utilities including JWT token management.
We found that abs-auth-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.