chore: rename project

This commit is contained in:
Lakhan Samani 2021-07-23 21:57:44 +05:30
parent aa6c22348e
commit 30f83aaf82
36 changed files with 118 additions and 116 deletions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 yauthio
Copyright (c) 2021 authorizer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,13 +1,13 @@
# yauth
#authorizer
yauth (aka your-auth) is a complete open source authentication and authorization solution for your applications. Bring your database and have complete control over the authentication, authorization and user data. It is a microservice that can be deployed anywhere and connected any sql database.
authorizer (aka your-auth) is a complete open source authentication and authorization solution for your applications. Bring your database and have complete control over the authentication, authorization and user data. It is a microservice that can be deployed anywhere and connected any sql database.
This an [Auth0](https://auth0.com) opensource alternative.
Deploy YAuth Server with Postgres DB on Heroku and get a YAuth GraphQL endpoint in under 30 seconds
Deploy authorizer Server with Postgres DB on Heroku and get a authorizer GraphQL endpoint in under 30 seconds
[![Deploy to
Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/yauthdev/yauth-heroku)
Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/authorizerdev/authorizer-heroku)
## Features
### Flexible and easy to use
@ -38,5 +38,5 @@ Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?
* Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.
# License
[MIT](https://github.com/yauthio/yauth/blob/main/LICENSE)
[MIT](https://github.com/authorizerdev/authorizer/blob/main/LICENSE)

View File

@ -1,4 +1,4 @@
# Roadmap for yauth.io
# Roadmap for authorizer
This document contains detailed information about the project scope and future roadmap
@ -43,9 +43,9 @@ This document contains detailed information about the project scope and future r
- [ ] Allow user to view users
- [ ] Allow user to define the JWT token field
- [x] A component library for react
- [x] Create YAuthProvider -> gives token, user, loading, setters
- [x] Create YAuth component -> Complete Login/Signup & Forgot password solution
- [x] Create YAuthResetPassword component -> Component that can be used to verify forgot password token and reset the password
- [x] Create AuthorizerProvider -> gives token, user, loading, setters
- [x] Create Authorizer component -> Complete Login/Signup & Forgot password solution
- [x] Create AuthorizerResetPassword component -> Component that can be used to verify forgot password token and reset the password
- [ ] Create a sdks
- [ ] NodeJS sdk which acts as a middleware and can be used to authenticate & authorize users
- [ ] Golang sdk which acts as a middleware and can be used to authenticate & authorize users

View File

@ -10,8 +10,8 @@ services:
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
yauth:
image: lakhansamani/yauth:0.1.0-beta.0
authorizer:
image: lakhansamani/authorizer:0.1.0-beta.0
ports:
- 8080:8080
depends_on:

View File

@ -6,12 +6,12 @@ import (
"os"
"strings"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/joho/godotenv"
"github.com/yauthdev/yauth/server/enum"
)
var (
YAUTH_ADMIN_SECRET = ""
ROOT_SECRET = ""
ENV = ""
DB_TYPE = ""
DB_URL = ""
@ -55,7 +55,7 @@ func init() {
if err != nil {
log.Println("Error loading .env file")
}
YAUTH_ADMIN_SECRET = os.Getenv("YAUTH_ADMIN_SECRET")
ROOT_SECRET = os.Getenv("ROOT_SECRET")
ENV = os.Getenv("ENV")
DB_TYPE = os.Getenv("DB_TYPE")
DB_URL = os.Getenv("DB_URL")
@ -78,8 +78,8 @@ func init() {
// FACEBOOK_CLIENT_SECRET = os.Getenv("FACEBOOK_CLIENT_SECRET")
FORGOT_PASSWORD_URI = strings.TrimPrefix(os.Getenv("FORGOT_PASSWORD_URI"), "/")
VERIFY_EMAIL_URI = strings.TrimPrefix(os.Getenv("VERIFY_EMAIL_URI"), "/")
if YAUTH_ADMIN_SECRET == "" {
panic("Yauth admin secret is required")
if ROOT_SECRET == "" {
panic("Root admin secret is required")
}
if ENV == "" {
@ -107,7 +107,7 @@ func init() {
}
if COOKIE_NAME == "" {
COOKIE_NAME = "yauth"
COOKIE_NAME = "authorizer"
}
if SERVER_URL == "" {

View File

@ -3,8 +3,8 @@ package db
import (
"log"
"github.com/yauthdev/yauth/server/constants"
"github.com/yauthdev/yauth/server/enum"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/enum"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/driver/sqlite"
@ -37,7 +37,7 @@ func init() {
log.Println("=> from db:", constants.DB_TYPE, constants.DB_URL)
ormConfig := &gorm.Config{
NamingStrategy: schema.NamingStrategy{
TablePrefix: "yauth_",
TablePrefix: "authorizer_",
},
}
if constants.DB_TYPE == enum.Postgres.String() {

View File

@ -8,7 +8,7 @@ import (
"net/smtp"
"strings"
"github.com/yauthdev/yauth/server/constants"
"github.com/authorizerdev/authorizer/server/constants"
)
/**

View File

@ -1,4 +1,4 @@
module github.com/yauthdev/yauth/server
module github.com/authorizerdev/authorizer/server
go 1.16

View File

@ -35,7 +35,7 @@ resolver:
# gqlgen will search for any type names in the schema in these go packages
# if they match it will use them, otherwise it will generate them.
autobind:
- 'github.com/yauthdev/yauth/server/graph/model'
- 'github.com/authorizerdev/authorizer/server/graph/model'
# This section declares type mapping between the GraphQL and go type systems
#

View File

@ -12,9 +12,9 @@ import (
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/introspection"
"github.com/authorizerdev/authorizer/server/graph/model"
gqlparser "github.com/vektah/gqlparser/v2"
"github.com/vektah/gqlparser/v2/ast"
"github.com/yauthdev/yauth/server/graph/model"
)
// region ************************** generated!.gotpl **************************
@ -39,8 +39,7 @@ type ResolverRoot interface {
Query() QueryResolver
}
type DirectiveRoot struct {
}
type DirectiveRoot struct{}
type ComplexityRoot struct {
Error struct {
@ -110,6 +109,7 @@ type MutationResolver interface {
ForgotPassword(ctx context.Context, params model.ForgotPasswordInput) (*model.Response, error)
ResetPassword(ctx context.Context, params model.ResetPassowrdInput) (*model.Response, error)
}
type QueryResolver interface {
Users(ctx context.Context) ([]*model.User, error)
Token(ctx context.Context) (*model.LoginResponse, error)
@ -3130,7 +3130,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co
func (ec *executionContext) unmarshalInputForgotPasswordInput(ctx context.Context, obj interface{}) (model.ForgotPasswordInput, error) {
var it model.ForgotPasswordInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3150,7 +3150,7 @@ func (ec *executionContext) unmarshalInputForgotPasswordInput(ctx context.Contex
func (ec *executionContext) unmarshalInputLoginInput(ctx context.Context, obj interface{}) (model.LoginInput, error) {
var it model.LoginInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3178,7 +3178,7 @@ func (ec *executionContext) unmarshalInputLoginInput(ctx context.Context, obj in
func (ec *executionContext) unmarshalInputResendVerifyEmailInput(ctx context.Context, obj interface{}) (model.ResendVerifyEmailInput, error) {
var it model.ResendVerifyEmailInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3198,7 +3198,7 @@ func (ec *executionContext) unmarshalInputResendVerifyEmailInput(ctx context.Con
func (ec *executionContext) unmarshalInputResetPassowrdInput(ctx context.Context, obj interface{}) (model.ResetPassowrdInput, error) {
var it model.ResetPassowrdInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3234,7 +3234,7 @@ func (ec *executionContext) unmarshalInputResetPassowrdInput(ctx context.Context
func (ec *executionContext) unmarshalInputSignUpInput(ctx context.Context, obj interface{}) (model.SignUpInput, error) {
var it model.SignUpInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3294,7 +3294,7 @@ func (ec *executionContext) unmarshalInputSignUpInput(ctx context.Context, obj i
func (ec *executionContext) unmarshalInputUpdateProfileInput(ctx context.Context, obj interface{}) (model.UpdateProfileInput, error) {
var it model.UpdateProfileInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {
@ -3362,7 +3362,7 @@ func (ec *executionContext) unmarshalInputUpdateProfileInput(ctx context.Context
func (ec *executionContext) unmarshalInputVerifyEmailInput(ctx context.Context, obj interface{}) (model.VerifyEmailInput, error) {
var it model.VerifyEmailInput
var asMap = obj.(map[string]interface{})
asMap := obj.(map[string]interface{})
for k, v := range asMap {
switch k {

View File

@ -6,9 +6,9 @@ package graph
import (
"context"
"github.com/yauthdev/yauth/server/graph/generated"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/resolvers"
"github.com/authorizerdev/authorizer/server/graph/generated"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/resolvers"
)
func (r *mutationResolver) Signup(ctx context.Context, params model.SignUpInput) (*model.Response, error) {
@ -65,5 +65,7 @@ func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResol
// Query returns generated.QueryResolver implementation.
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
type mutationResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }
type (
mutationResolver struct{ *Resolver }
queryResolver struct{ *Resolver }
)

View File

@ -2,9 +2,9 @@ package handlers
import (
"github.com/99designs/gqlgen/graphql/handler"
"github.com/authorizerdev/authorizer/server/graph"
"github.com/authorizerdev/authorizer/server/graph/generated"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/graph"
"github.com/yauthdev/yauth/server/graph/generated"
)
// Defining the Graphql handler

View File

@ -8,13 +8,13 @@ import (
"strings"
"time"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/oauth"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/constants"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/oauth"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"golang.org/x/oauth2"
)

View File

@ -3,11 +3,11 @@ package handlers
import (
"net/http"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/oauth"
"github.com/authorizerdev/authorizer/server/session"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/oauth"
"github.com/yauthdev/yauth/server/session"
)
func OAuthLoginHandler(provider enum.OAuthProvider) gin.HandlerFunc {

View File

@ -5,12 +5,12 @@ import (
"net/http"
"time"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/constants"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
)
func VerifyEmailHandler() gin.HandlerFunc {

View File

@ -1,7 +1,7 @@
package oauth
import (
"github.com/yauthdev/yauth/server/constants"
"github.com/authorizerdev/authorizer/server/constants"
"golang.org/x/oauth2"
githubOAuth2 "golang.org/x/oauth2/github"
googleOAuth2 "golang.org/x/oauth2/google"

View File

@ -7,10 +7,10 @@ import (
"strings"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func ForgotPassword(ctx context.Context, params model.ForgotPasswordInput) (*model.Response, error) {

View File

@ -6,11 +6,11 @@ import (
"log"
"strings"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
"golang.org/x/crypto/bcrypt"
)

View File

@ -3,9 +3,9 @@ package resolvers
import (
"context"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
)
func Logout(ctx context.Context) (*model.Response, error) {

View File

@ -4,10 +4,10 @@ import (
"context"
"fmt"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
)
func Profile(ctx context.Context) (*model.User, error) {

View File

@ -7,9 +7,9 @@ import (
"strings"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func ResendVerifyEmail(ctx context.Context, params model.ResendVerifyEmailInput) (*model.Response, error) {

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func ResetPassword(ctx context.Context, params model.ResetPassowrdInput) (*model.Response, error) {

View File

@ -7,10 +7,10 @@ import (
"strings"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func Signup(ctx context.Context, params model.SignUpInput) (*model.Response, error) {

View File

@ -5,11 +5,11 @@ import (
"fmt"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
)
func Token(ctx context.Context) (*model.LoginResponse, error) {

View File

@ -7,11 +7,11 @@ import (
"strings"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
"golang.org/x/crypto/bcrypt"
)

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func Users(ctx context.Context) ([]*model.User, error) {

View File

@ -4,9 +4,9 @@ import (
"context"
"fmt"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/utils"
)
func VerificationRequests(ctx context.Context) ([]*model.VerificationRequest, error) {

View File

@ -5,11 +5,11 @@ import (
"fmt"
"time"
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
"github.com/authorizerdev/authorizer/server/db"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/session"
"github.com/authorizerdev/authorizer/server/utils"
)
func VerifyEmail(ctx context.Context, params model.VerifyEmailInput) (*model.LoginResponse, error) {

View File

@ -4,10 +4,10 @@ import (
"context"
"log"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/authorizerdev/authorizer/server/handlers"
"github.com/authorizerdev/authorizer/server/oauth"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/enum"
"github.com/yauthdev/yauth/server/handlers"
"github.com/yauthdev/yauth/server/oauth"
)
func GinContextToContextMiddleware() gin.HandlerFunc {

View File

@ -4,8 +4,8 @@ import (
"context"
"log"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/go-redis/redis/v8"
"github.com/yauthdev/yauth/server/constants"
)
type SessionStore struct {

View File

@ -6,10 +6,10 @@ import (
"strings"
"time"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/enum"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt"
"github.com/yauthdev/yauth/server/constants"
"github.com/yauthdev/yauth/server/enum"
)
type UserAuthInfo struct {

View File

@ -5,8 +5,8 @@ import (
"net/http"
"net/url"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/constants"
)
func SetCookie(gc *gin.Context, token string) {

View File

@ -3,8 +3,8 @@ package utils
import (
"fmt"
"github.com/yauthdev/yauth/server/constants"
"github.com/yauthdev/yauth/server/email"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/email"
)
// SendVerificationMail to send verification email

View File

@ -4,7 +4,7 @@ import (
"net/url"
"strings"
"github.com/yauthdev/yauth/server/constants"
"github.com/authorizerdev/authorizer/server/constants"
)
func GetDomainName() string {

View File

@ -1,8 +1,8 @@
package utils
import (
"github.com/authorizerdev/authorizer/server/constants"
"github.com/gin-gonic/gin"
"github.com/yauthdev/yauth/server/constants"
)
func IsSuperAdmin(gc *gin.Context) bool {
@ -11,5 +11,5 @@ func IsSuperAdmin(gc *gin.Context) bool {
return false
}
return secret == constants.YAUTH_ADMIN_SECRET
return secret == constants.ROOT_SECRET
}

View File

@ -3,8 +3,8 @@ package utils
import (
"time"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/golang-jwt/jwt"
"github.com/yauthdev/yauth/server/constants"
)
type UserInfo struct {