You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/01 14:32:01 UTC

[GitHub] [airflow] ashb commented on a change in pull request #14219: Provide login endpoint for the REST API with JWT authentication method

ashb commented on a change in pull request #14219:
URL: https://github.com/apache/airflow/pull/14219#discussion_r584756617



##########
File path: airflow/api_connexion/openapi/v1.yaml
##########
@@ -1381,11 +1381,178 @@ paths:
               schema:
                 $ref: '#/components/schemas/VersionInfo'
 
+  /login:
+    post:
+      summary: User login
+      description: |
+        Verify user and return a user object and JWT token as well
+      x-openapi-router-controller: airflow.api_connexion.endpoints.user_endpoint
+      operationId: login
+      tags: [User]
+
+      responses:
+        '200':
+          description: Success.
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/UserLogin'
+        '400':
+          $ref: '#/components/responses/BadRequest'
+        '401':
+          $ref: '#/components/responses/Unauthenticated'
 
 components:
   # Reusable schemas (data models)
   schemas:
     # Database entities
+    User:
+      description: >
+        A user object
+      type: object
+      properties:
+        id:
+          type: string
+          description: The user id
+          readOnly: true
+        first_name:
+          type: string
+          description: The user firstname
+        last_name:
+          type: string
+          description: The user lastname
+        username:
+          type: string
+          description: The username
+        email:
+          type: string
+          description: The user's email
+        active:
+          type: boolean
+          description: Whether the user is active
+        last_login:
+          type: string
+          format: datetime
+          description: The last user login
+          readOnly: true
+        login_count:
+          type: integer
+          description: The login count
+          readOnly: true
+        failed_login_count:
+          type: integer
+          description: The number of times the login failed
+          readOnly: true
+        roles:
+          type: array
+          description: User roles
+          items:
+            $ref: '#/components/schemas/RoleCollectionItem'
+          readOnly: true
+          nullable: true
+        created_on:
+          type: string
+          format: datetime
+          description: The date user was created
+          readOnly: true
+        changed_on:
+          type: string
+          format: datetime
+          description: The date user was changed
+          readOnly: true
+
+    UserLogin:
+      description: Login item
+      allOf:
+        - $ref: '#/components/schemas/User'
+        - type: object
+          properties:
+            token:
+              type: string
+              nullable: false
+              description: JWT token
+
+    RoleCollectionItem:

Review comment:
       I agree with Kamil here, I think just calling this `Role` would be clearer (and a RoleCollection has a array of Role items in it) -- don't think we need to separation really.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org