auth-framework 0.5.0-rc18

A comprehensive, production-ready authentication and authorization framework for Rust applications
Documentation
# Authentication and Account Verification Endpoints

register:
    post:
        tags:
            - Authentication
        summary: Register a new user
        operationId: register
        requestBody:
            required: true
            content:
                application/json:
                    schema:
                        $ref: "../schemas/auth.yaml#/RegisterRequest"
        responses:
            "200":
                description: Registration completed successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          $ref: "../schemas/auth.yaml#/RegisterResponse"
            "400":
                $ref: "../components/responses.yaml#/BadRequest"
            "409":
                $ref: "../components/responses.yaml#/Conflict"

login:
    post:
        tags:
            - Authentication
        summary: Log in with username and password
        description: Submit challenge_id and mfa_code together to complete a pending login MFA challenge on the same endpoint.
        operationId: login
        requestBody:
            required: true
            content:
                application/json:
                    schema:
                        $ref: "../schemas/auth.yaml#/LoginRequest"
        responses:
            "200":
                description: Login completed successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          $ref: "../schemas/auth.yaml#/LoginResponse"
            "400":
                $ref: "../components/responses.yaml#/BadRequest"
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"
            "429":
                $ref: "../components/responses.yaml#/RateLimit"

refresh:
    post:
        tags:
            - Authentication
        summary: Rotate a refresh token
        description: The refresh handler issues a new access token and a new refresh token.
        operationId: refreshToken
        requestBody:
            required: true
            content:
                application/json:
                    schema:
                        $ref: "../schemas/auth.yaml#/RefreshTokenRequest"
        responses:
            "200":
                description: Token refresh completed successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          $ref: "../schemas/auth.yaml#/TokenResponse"
            "400":
                $ref: "../components/responses.yaml#/BadRequest"
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"

logout:
    post:
        tags:
            - Authentication
        summary: Log out and revoke the current access token
        operationId: logout
        security:
            - bearerAuth: []
        requestBody:
            required: false
            content:
                application/json:
                    schema:
                        $ref: "../schemas/auth.yaml#/LogoutRequest"
        responses:
            "200":
                description: Logout completed successfully
                content:
                    application/json:
                        schema:
                            $ref: "../schemas/common.yaml#/ApiResponse"
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"

validate:
    get:
        tags:
            - Authentication
        summary: Validate the current access token
        operationId: validateToken
        security:
            - bearerAuth: []
        responses:
            "200":
                description: Token is valid
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          $ref: "../schemas/auth.yaml#/TokenValidationResponse"
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"

providers:
    get:
        tags:
            - Authentication
        summary: List configured OAuth login providers
        operationId: listProviders
        responses:
            "200":
                description: Provider list returned successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          type: array
                                          items:
                                              type: object
                                              properties:
                                                  name:
                                                      type: string
                                                  display_name:
                                                      type: string
                                                  auth_url:
                                                      type: string
                                              required:
                                                  - name
                                                  - display_name
                                                  - auth_url

apiKeys:
    post:
        tags:
            - Authentication
        summary: Create an API key for the authenticated user
        operationId: createApiKey
        security:
            - bearerAuth: []
        responses:
            "200":
                description: API key created successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          type: object
                                          properties:
                                              api_key:
                                                  type: string
                                              token_type:
                                                  type: string
                                                  example: "ApiKey"
                                          required:
                                              - api_key
                                              - token_type
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"

verifyEmailSend:
    post:
        tags:
            - Authentication
        summary: Generate an email verification token for the authenticated user
        operationId: sendVerificationEmail
        security:
            - bearerAuth: []
        responses:
            "200":
                description: Verification token generated or already verified state returned
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          type: object
                                          properties:
                                              sent:
                                                  type: boolean
                                              verification_token:
                                                  type: string
                                              message:
                                                  type: string
                                          required:
                                              - sent
                                              - verification_token
                                              - message
            "401":
                $ref: "../components/responses.yaml#/Unauthorized"

verifyEmail:
    post:
        tags:
            - Authentication
        summary: Confirm ownership of an email address
        operationId: verifyEmail
        requestBody:
            required: true
            content:
                application/json:
                    schema:
                        type: object
                        properties:
                            token:
                                type: string
                        required:
                            - token
        responses:
            "200":
                description: Email address verified successfully
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          type: object
                                          properties:
                                              verified:
                                                  type: boolean
                                              user_id:
                                                  type: string
                                              message:
                                                  type: string
                                          required:
                                              - verified
                                              - user_id
                                              - message
            "400":
                $ref: "../components/responses.yaml#/BadRequest"

resendVerification:
    post:
        tags:
            - Authentication
        summary: Generate a new verification token for an email address
        operationId: resendVerification
        requestBody:
            required: true
            content:
                application/json:
                    schema:
                        type: object
                        properties:
                            email:
                                type: string
                                format: email
                        required:
                            - email
        responses:
            "200":
                description: Generic resend-verification response returned
                content:
                    application/json:
                        schema:
                            allOf:
                                - $ref: "../schemas/common.yaml#/ApiResponse"
                                - type: object
                                  properties:
                                      data:
                                          type: object
                                          properties:
                                              sent:
                                                  type: boolean
                                              verification_token:
                                                  type: string
                                              message:
                                                  type: string
                                          required:
                                              - sent
                                              - verification_token
                                              - message