vincbeck commented on code in PR #59411:
URL: https://github.com/apache/airflow/pull/59411#discussion_r2662283650
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/datamodels/token.py:
##########
@@ -28,8 +34,47 @@ class TokenResponse(BaseModel):
access_token: str
-class TokenBody(StrictBaseModel):
- """Token serializer for post bodies."""
+class TokenPasswordBody(StrictBaseModel):
+ """Password Grant Token serializer for post bodies."""
Review Comment:
```suggestion
"""Password grant token serializer for post bodies."""
```
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/datamodels/token.py:
##########
@@ -28,8 +34,47 @@ class TokenResponse(BaseModel):
access_token: str
-class TokenBody(StrictBaseModel):
- """Token serializer for post bodies."""
+class TokenPasswordBody(StrictBaseModel):
+ """Password Grant Token serializer for post bodies."""
+ grant_type: Literal["password"] = "password"
username: str = Field()
password: str = Field()
+
+ def create_token(self, expiration_time_in_seconds: int) -> str:
+ """Create token using password grant."""
+ return create_token_for(
+ self.username, self.password,
expiration_time_in_seconds=expiration_time_in_seconds
+ )
+
+
+class TokenClientCredentialsBody(StrictBaseModel):
+ """Client Credentials Grant Token serializer for post bodies."""
Review Comment:
```suggestion
"""Client credentials grant token serializer for post bodies."""
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]