Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSOC API Auth Draft-PR #776

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

StormGear
Copy link
Contributor

PR Description

  1. Proposal Title
  • Adding Support for API Authentication Methods
  1. Abstract: A brief summary about the problem that you will be tackling & how.
  • Authentication Methods Overview for this PR
  1. Basic Authentication

Simple username/password transmission
Credentials encoded in Base64
Sent via HTTP Authorization header.

  1. API Key Authentication

Single token for identifying application/user
Can be sent via Request headers or
Query parameters

  1. Bearer Token Authentication

Uses access tokens for authorization typically JWT-based
Stateless authentication mechanism.

My Approach

New Models

I created new models (AuthorizationModel) with various submodels ( BasicAuthModel, BearerAuthModel, ApikeyAuthModels). These are data models that handle data entered by users.
AuthorizationModel has fields

  • AuthType authType - The type of authorization.
  • Bool isEnabled - Is authorization enabled for selected request?
  • BasicAuthModel basicAuthModel - stores data for basic authorization type
  • BearerAuthModel bearerAuthModel - stores data for bearer authorization type
  • ApikeyAuthModel apikeyAuthModel - stores data for api key authorization type

StateProviders

AuthorizationProvider for managing the state of the Authorization types

  • update method to update fields within the Authorization model
  • _syncwithRequest method to sync these values with the selected RequestModel

User Interface

A Tab for enabling and including the various Authorization tabs, currently implemently in this draft PR:

  • Basic Authentication
  • Bearer Token Authentication

A Visual Summary of My Approach

In this image, I have visually presented my approach to this draft PR.
summary

A Video Demo

In this video, I demonstrate how to enable Authorization for Basic Authorization as well as Bearer Token Authorization. Nasa and Postman Public APIs were used as they support these types of authorization.
I attempted to upload the video here several times, somehow, it wasn't working, hence I have placed the video in this Gdrive:
Link to Video Demo

As I progress through this contribution more authorization types will be incrementally added.

Related Issues

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch (run flutter upgrade and verify)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

  • Yes
  • No, and this is why: This is a draft PR to demonstrate approach, test would be included as I progress with the contributions.

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants