Fluent Implementations For Vapor OAuth
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources
Tests
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Package.swift
Package@swift-4.swift
README.md
codecov.yml

README.md

Vapor OAuth Fluent

Vapor OAuth Fluent

Language Build Status Code Coverage MIT License

This repo contains a Fluent implementations for the required protocols for Vapor OAuth.

Usage

Vapor OAuth can Fluent be added to your Vapor add with a simple provider. To get started, first add the library to your Package.swift dependencies:

dependencies: [
    ...,
    .package(url: "https://github.com/brokenhandsio/vapor-oauth-fluent", .upToNextMajor(from: "0.4.0"))
]

Next import the library into where you set up your Droplet:

import VaporOAuthFluent

Then choose the implementations you wish to add the provider you add in your Config. For example:

try addProvider(VaporOAuth.Provider(codeManager: FluentCodeManager(), tokenManager: FluentTokenManager(), clientRetriever: FluentClientRetriever(), authorizeHandler: MyAuthHandler(), userManager: FluentUserManager(), validScopes: ["view_profile", "edit_profile"], resourceServerRetriever: FluentResourceServerRetriever()))

You can choose which implementations to use, or write your custom ones. For instance you may choose to use Fluent for Tokens and Users, but hard code the clients and use JWT to manage Codes.

Models Included

The following models have Fluent extensions included with this repository:

  • AccessToken
  • RefreshToken
  • OAuthCode
  • OAuthUser
  • OAuthClient
  • OAuthResourceServer

Note you will need to add these models to your preparations if you wish to use any of these.

Managers Included

As well as models, Vapor OAuth Fluent includes implementations for the Managers required to interact with the models. The included managers are:

  • FluentClientRetriever
  • FluentCodeManager
  • FluentTokenManager
  • FluentUserManager
  • FluentResourceServerRetriever