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 08:23:42 UTC

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

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



##########
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:

Review comment:
       I'm lost at what to return for the user part. The way I was thinking about this was to return all necessary info about the user so it can be used to check if the user has permissions on certain items on the UI, and also used to update some user info in the UI. I'm thinking about it towards the new UI.
   
   Would be glad to know what to return for the user part and your thoughts on what I'm thinking above




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