openbankproject_client.auth module
Authentication utilities for the OpenBankProject API Client.
- class openbankproject_client.auth.DirectLoginAuth(username: str | None = None, password: str | None = None, consumer_key: str | None = None, token: str | None = None)[source]
Bases:
objectAuthentication handler for DirectLogin authentication method.
- __init__(username: str | None = None, password: str | None = None, consumer_key: str | None = None, token: str | None = None)[source]
Initialize DirectLogin authentication.
- Parameters:
username – User’s username (required if token not provided)
password – User’s password (required if token not provided)
consumer_key – Consumer key for the application (required if token not provided)
token – Pre-generated DirectLogin token (optional)
- class openbankproject_client.auth.GatewayLoginAuth(token: str)[source]
Bases:
objectAuthentication handler for GatewayLogin authentication method.
- __init__(token: str)[source]
Initialize GatewayLogin authentication.
- Parameters:
token – GatewayLogin JWT token
- class openbankproject_client.auth.Authentication[source]
Bases:
objectAuthentication utilities for the OpenBankProject API.
- static create_direct_login_header(username: str, password: str, consumer_key: str) Dict[str, str][source]
Create a DirectLogin authorization header.
- Parameters:
username – User’s username
password – User’s password
consumer_key – Consumer key for the application
- Returns:
Dict containing the Authorization header
- static create_gateway_login_header(jwt: str) Dict[str, str][source]
Create a GatewayLogin authorization header.
- Parameters:
jwt – JSON Web Token for authentication
- Returns:
Dict containing the Authorization header
- static create_token_header(token: str, auth_type: str = 'DirectLogin') Dict[str, str][source]
Create an authorization header using a token.
- Parameters:
token – Authentication token
auth_type – Authentication type (DirectLogin or GatewayLogin)
- Returns:
Dict containing the Authorization header
- static generate_jwt(consumer_key: str, consumer_secret: str, user_id: str | None = None, expiry_seconds: int = 3600) str[source]
Generate a JWT token for GatewayLogin.
This is a simplified implementation and may need to be adjusted based on the specific requirements of the OpenBankProject API.
- Parameters:
consumer_key – Consumer key for the application
consumer_secret – Consumer secret for the application
user_id – Optional user ID to include in the token
expiry_seconds – Token expiry time in seconds (default: 1 hour)
- Returns:
JWT token string