All Projects → madsodgaard → Vapor Auth Template

madsodgaard / Vapor Auth Template

Licence: mit
A Vapor 4 template with authentication, Fluent, JWT, Queues, repository pattern, testing and more.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Vapor Auth Template

Jwt
Vapor JWT provider
Stars: ✭ 266 (+125.42%)
Mutual labels:  server-side-swift, authentication, jwt
Django Graphql Social Auth
Python Social Auth support for Graphene Django
Stars: ✭ 90 (-23.73%)
Mutual labels:  authentication, jwt
Sjwt
Simple JWT Golang
Stars: ✭ 86 (-27.12%)
Mutual labels:  authentication, jwt
Spring Security React Ant Design Polls App
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Stars: ✭ 1,336 (+1032.2%)
Mutual labels:  authentication, jwt
Vouch Proxy
an SSO and OAuth / OIDC login solution for Nginx using the auth_request module
Stars: ✭ 1,239 (+950%)
Mutual labels:  authentication, jwt
Go Alone
A simple to use, high-performance, Go (golang) MAC signer.
Stars: ✭ 82 (-30.51%)
Mutual labels:  authentication, jwt
Djwt
Create and verify JSON Web Tokens (JWT) with deno.
Stars: ✭ 93 (-21.19%)
Mutual labels:  authentication, jwt
Flask Restful Authentication
An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).
Stars: ✭ 63 (-46.61%)
Mutual labels:  authentication, jwt
Express Jwt
An example API for creating/verifying json web tokens
Stars: ✭ 105 (-11.02%)
Mutual labels:  authentication, jwt
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-6.78%)
Mutual labels:  authentication, jwt
Go Postgres Jwt React Starter
A go, gin, and postgres API with jwt auth, complete with a react frontend
Stars: ✭ 115 (-2.54%)
Mutual labels:  authentication, jwt
Authex
Authex is an opinionated JWT authentication and authorization library for Elixir.
Stars: ✭ 73 (-38.14%)
Mutual labels:  authentication, jwt
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-39.83%)
Mutual labels:  authentication, jwt
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+955.08%)
Mutual labels:  authentication, jwt
Grpc Auth Example
Examples of client authentication with gRPC
Stars: ✭ 65 (-44.92%)
Mutual labels:  authentication, jwt
Ngx Api Utils
ngx-api-utils is a lean library of utilities and helpers to quickly integrate any HTTP API (REST, Ajax, and any other) with Angular.
Stars: ✭ 92 (-22.03%)
Mutual labels:  authentication, jwt
Nextjs Headless Wordpress
🔥 Nextjs Headless WordPress
Stars: ✭ 110 (-6.78%)
Mutual labels:  authentication, jwt
Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+827.12%)
Mutual labels:  authentication, jwt
Ldap Jwt
Lightweight node.js based web service that provides user authentication against LDAP server (Active Directory / Windows network) credentials and returns a JSON Web Token.
Stars: ✭ 58 (-50.85%)
Mutual labels:  authentication, jwt
Barong
Barong auth server
Stars: ✭ 100 (-15.25%)
Mutual labels:  authentication, jwt

Vapor Authentication Template

Swift 5.2 Vapor 4

This package is a Vapor 4 template to showcase different features and include authentication functions needed for a lot of apps. It uses concepts such as: repository pattern, queues, jwt, fluent, testing and mailgun

The template can be cloned and configured/changed to fit your needs, but should give a good starting point to anyone new to Vapor.

Features

  • User registration
  • User login
  • Reset password
  • Email verification
  • Refresh and access tokens
  • Testing
  • JWT Authentication
  • Queues for email sending
  • Repository Pattern
  • Mailgun

Routes

URL HTTP Method Description Content (Body)
/api/auth/register POST Registers a user and sends email verification RegisterRequest
/api/auth/login POST Login with existing user (requires email verification) LoginRequest
/api/auth/email-verification GET Used to verify an email with a email verification token Query parameter token
/api/auth/email-verification POST (Re)sends email verification to a specific email SendEmailVerification
/api/auth/reset-password POST Sends reset-password email with token ResetPasswordRequest
/api/auth/reset-password/verify GET Verifies a given reset-password token Query parameter token
/api/auth/recover POST Changes user password with reset-password token supplied RecoverAccountRequest
/api/auth/me GET Returns the current authenticated user None
/api/auth/accessToken POST Gives the user a new accesstoken and refresh token AccessTokenRequest

Configuration

Environment variables

These environment variables will be used for configuring different services by default: | Key | Default Value | Description | |---------------------|--------------------------|-----------------------------------------------------------------------------------------------------| | POSTGRES_HOSTNAME | localhost | Postgres hostname | | POSTGRES_USERNAME | vapor | Postgres usernane | | POSTGRES_PASSWORD | password | Postgres password | | POSTGRES_DATABASE | vapor | Postgres database | | JWKS_KEYPAIR_FILE | keypair.jwks | JWKS Keypair file relative to root directory see "JWT" section for more info | | MAILGUN_API_KEY | None | Mailgun API Key | | SITE_API_URL | None | The URL where your API will be hosted ex: "https://api.myapp.com" (used for email-verification URL) | | SITE_FRONTEND_URL | None | The URL where your frontend will be hosted ex: "http://myapp.com" (used for reset-password URL) | | NO_REPLY_EMAIL | None | The no reply email that will be used for Mailgun | | REDIS_URL | redis://127.0.0.1:6379 | Redis URL for Queues worker. |

App config

AppConfig contains configuration like API URL, frontend URL and no-reply email. It loads from environment variables by default. Otherwise you can override it inside configure.swift:

app.config = .init(...)

Constants

Constants.swift contains constants releated to tokens lifetime. | Token | Lifetime | |--------------------------|------------| | Access Token | 15 minutes | | Refresh Token | 7 days | | Email Verification Token | 24 hours | | Reset Password Token | 1 hour |

Mailgun

The template uses VaporMailgunService and be configured as it states in the documentation. Extensions/Mailgun+Domains.swift contains the domains.

JWT

This package uses JWT for Access Tokens, and by default it loads JWT credentials from a JWKS file called keypair.jwks in the root directory. You can generate a JWKS keypair at https://mkjwk.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].