Skip to content

Commit

Permalink
Merge article1 to master (#3)
Browse files Browse the repository at this point in the history
* A few corrections.

* Lint

* Whack dockerfiles; these are for part 2.

* Whack more docker stuff.
  • Loading branch information
git-steven authored Apr 10, 2024
1 parent 58f3c3e commit f93b118
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 103 deletions.
6 changes: 0 additions & 6 deletions Dockerfile.fastapi

This file was deleted.

12 changes: 0 additions & 12 deletions Dockerfile.lambda

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ FastAPI Service with JWT verification and tests.

## Article
Associated article can be found at these locations:
* Personal portfolio:
* Personal portfolio: http://localhost:4000/fastapi/python/jwt/authentication/security/fast-api-with-jwt/
* LinkedIn:
* Medium:

Expand Down
4 changes: 2 additions & 2 deletions article.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ERR_MISSING_API_TOKEN = "Missing API token"
async def verify_jwt(authorization: Annotated[str | None, Header()] = None) -> None:
"""
Verify the JWT in the authorization header. A 401 status code is sent back if
it is not present, malformed, or does not contain the corrrect apiKey.
it is not present, malformed, or does not contain the correct apiKey.
:param authorization: The authorization header
:return: None
:raises HTTPException: Results in a 404 with error message if something goes wrong
Expand Down Expand Up @@ -241,7 +241,7 @@ This allows us to invoke our service, e.g.,
response = client.get("/service/account/ACCOUNT_USERNAME")
```

We also need to import our [JWT utility](https://github.com/tangledpath/fast-api-jwt/blob/article1/fast_api_jwt/utils/jw_util.py) from above in order to encode the JWT and make it available as a request header, as well as
We also need to import our [JWT utility](https://github.com/tangledpath/fast-api-jwt/blob/article1/fast_api_jwt/utils/jwt_util.py) from above in order to encode the JWT and make it available as a request header, as well as
the error messages that will be returned if any part of the request is incorrect.
```python
from fast_api_jwt.service.dependencies import ERR_AUTH_HEADER_MISSING, ERR_INCORRECT_API_TOKEN, ERR_MISSING_API_TOKEN
Expand Down
30 changes: 0 additions & 30 deletions compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/fast_api_jwt.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2 id="article">Article</h2>
<p>Associated article can be found at these locations:</p>

<ul>
<li>Personal portfolio: </li>
<li>Personal portfolio: <a href="http://localhost:4000/fastapi/python/jwt/authentication/security/fast-api-with-jwt/">http://localhost:4000/fastapi/python/jwt/authentication/security/fast-api-with-jwt/</a></li>
<li>LinkedIn:</li>
<li>Medium:</li>
</ul>
Expand Down
80 changes: 47 additions & 33 deletions docs/fast_api_jwt/service/dependencies.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/search.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion fast_api_jwt/service/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
async def verify_jwt(authorization: Annotated[str | None, Header()] = None) -> None:
"""
Verify the JWT in the authorization header. A 401 status code is sent back if
it is not present, malformed, or does not contain the corrrect apiKey.
it is not present, malformed, or does not contain the correct apiKey.
:param authorization: The authorization header
:return: None
:raises HTTPException: Results in a 404 with error message if something goes wrong
"""

if not authorization:
raise HTTPException(status_code=401, detail=ERR_AUTH_HEADER_MISSING)
try:
Expand Down
2 changes: 1 addition & 1 deletion fast_api_jwt/service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ async def root(self):

# Start the service:
if __name__ == "__main__":
uvicorn.run("fast_api_jwt.service.main:app", port=9000, reload=True)
uvicorn.run("fast_api_jwt.service.main:app", port=8000, reload=True)
3 changes: 0 additions & 3 deletions script/docker-handler-sh.sh

This file was deleted.

3 changes: 0 additions & 3 deletions script/docker-sh.sh

This file was deleted.

7 changes: 0 additions & 7 deletions script/docker-start.sh

This file was deleted.

4 changes: 2 additions & 2 deletions script/start-server.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/script/bash
uvicorn fast_api_jwt.service.main:app --port 9000 --reload
#!/bin/bash
uvicorn fast_api_jwt.service.main:app --port 8000 --reload

0 comments on commit f93b118

Please sign in to comment.