Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a5e0ac1
Add FAPI URL and BAPI URL to config.
alexbalakirev Oct 26, 2024
541d81b
Adapt issuer validation
alexbalakirev Oct 26, 2024
15d5b4a
Rename short-term session to session-token
alexbalakirev Oct 27, 2024
e9709c0
Bump release version to 2.0.0
alexbalakirev Oct 27, 2024
4472ab8
Rename get_and_validate_short_session_value to validate_token
alexbalakirev Oct 27, 2024
c8b0c68
Change validate_token error handling, add new exception type for sess…
alexbalakirev Oct 27, 2024
8f8d625
Adapt existing token validation tests to new error handling
alexbalakirev Oct 27, 2024
0e3e17c
Add new tests to session service for issuer validation and false priv…
alexbalakirev Oct 27, 2024
338ede3
Add new test for issuer validation in session service
alexbalakirev Oct 27, 2024
96372a4
Update README.md
alexbalakirev Oct 27, 2024
112dc08
Remove session_token_cookie_name
alexbalakirev Nov 3, 2024
58000a8
Reorder required fields for configuration
alexbalakirev Nov 3, 2024
826c295
Improved exception handling, renamed error codes
alexbalakirev Nov 3, 2024
21caa9a
Change CORBADO_FRONTEND_API from variable to secret
alexbalakirev Nov 3, 2024
cc785d8
reduce public fields of session service
lukaskratzel Jan 23, 2025
9dcaa43
update session token validation example
lukaskratzel Jan 23, 2025
edd1586
adjust workflow to use var instead of secret
lukaskratzel Jan 23, 2025
43de3c2
return to public fields to make pydantic happy
lukaskratzel Jan 23, 2025
5be424d
Enable CI/CD on changes on merge request
alexbalakirev Jan 23, 2025
612f4c7
Increase maximum line length on linting
alexbalakirev Jan 23, 2025
8c7fcbe
Run CI/CD on Github Issue naming pattern
alexbalakirev Jan 23, 2025
db9f228
satisfy mypy
lukaskratzel Jan 23, 2025
d372b3d
update generated client and openapi specs
lukaskratzel Jan 23, 2025
e99adda
enforce no trailing slashes in config urls
lukaskratzel Jan 23, 2025
73a73ad
remove last_session_token_validation_result from session_service.py
lukaskratzel Jan 23, 2025
f842777
satisfy flake8
lukaskratzel Jan 23, 2025
2834573
remove all usages of _set_validation_error
lukaskratzel Jan 23, 2025
ccddb45
adjust test_set_cname_expect_issuer_changed to new url validation exp…
lukaskratzel Jan 23, 2025
3ede93c
satisfy mypy
lukaskratzel Jan 23, 2025
fe9f6cc
remove unnecessary file
lukaskratzel Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extend-ignore = D100, DC100

exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,src/corbado_python_sdk/generated,env,.idea,.vscode,scripts,__init__.py,.venv,.tox,setup.*,venv_name

max-line-length = 130
max-line-length = 150

per-file-ignores =
#exclude some chekcs in test code
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ name: Python package

on:
push:
branches: [ "main","feature/**","development"]
branches: [ "main","feature/**","development", "[0-9]+-*"]
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches: [ "main","development"]
types: [opened, reopened]
types: [opened, reopened, edited]

jobs:
test-and-lint:
Expand Down Expand Up @@ -48,9 +48,11 @@ jobs:
run: |
tox run
env:
CORBADO_BACKEND_API: ${{ vars.CORBADO_BACKEND_API }}
CORBADO_API_SECRET: ${{ secrets.CORBADO_API_SECRET }}
CORBADO_PROJECT_ID: ${{ secrets.CORBADO_PROJECT_ID }}
CORBADO_API_SECRET: ${{ secrets.CORBADO_API_SECRET }}
CORBADO_FRONTEND_API: ${{ vars.CORBADO_FRONTEND_API }}
CORBADO_BACKEND_API: ${{ vars.CORBADO_BACKEND_API }}



build:
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,23 @@ user_service: UserService = sdk.users

### Error handling

The Corbado Python SDK raises exceptions for all errors except those that occur in the session service during token validation (See example below on how to catch those errors). The following exceptions are thrown:
The Corbado Python SDK raises exceptions for all errors. The following exceptions are thrown:

- `ValidationError` for failed validations (client side)
- `ServerException` for server errors (server side)
- `TokenValidationException` for errors in session service (client side)
- `StandardException` for everything else (client side)

'SessionService' returns 'SessionValidationResult' as result of token validation. You can check whether any errors occurred and handle them if needed:
`SessionService` returns a `UserEntity` as a result of token validation. If the token is invalid for any reason,
a `TokenValidationException` is thrown. It provides detailed information on the error.
If no error, is thrown, the `session_token` is valid and you can use the `UserEntity` object.

```Python
result: SessionValidationResult = self.session_service.get_and_validate_short_session_value(short_session=token)
if result.error is not None:
print(result.error)
raise result.error
try:
user: UserEntity = sdk.sessions.validate_token(session_token)
except TokenValidationException:
# handle error..
pass
```

If the Backend API returns a HTTP status code other than 200, the Corbado Python SDK throws a `ServerException`. The `ServerException`class provides convenient methods to access all important data:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.3
2.0.0
Loading
Loading