Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

feat: authentication system #108

Merged
merged 18 commits into from Mar 11, 2022
Merged

feat: authentication system #108

merged 18 commits into from Mar 11, 2022

Conversation

yk-eukarya
Copy link
Contributor

Overview

What I've done

What I haven't done

How I tested

Which point do I want you to review particularly

Memo

yk-eukarya and others added 14 commits November 17, 2021 20:42
* auth server imp

* fix

* - fix state parameter
- add x509 cert implementation

* - add x509 cert to key store
- fix request is not updated
- fix refresh token flow
- handle login error messages
- get first key as default if kid is not presented

* - fix linting issues

* - accept form payload in login request

* - code enhancement
- fix PR comments

* - fix devMode

* - give credentials type a better name

* - add test for User_GetAuthByProvider

* - define custom error for invalid login

* - enhance unique list method performance

* - fix package alias

* - refactor storage init

* - use usecase instead of controller
- remove unused controller method

* - move shared clients into separated file

* - handle concurrency in auth storage

* - fix go mod

* - refactor part of the code

* - fix error handling
- load Pkix from config

* - use dummy DN for the cert
- remove unnecessary fields from the cert

* - get user info from db

* - add missing cn
- pass get user func instead of userUseCase

* - code enhancement
* - logout api

* - remove the unnecessary wrap method
- fix http redirection status

* - add another logout endpoint for auth0/auth0-react
* feat: create mailer (go-mailer is used)

* fix linter

* sendGrid implementation

* refactor: separate smtp and sendgrid

* refactor: add sender name to config

* fix newWithSMTP wrong parameter

* mixed email content
break down MailerConfig struct

* resolve notes

* resolve notes
testing

* testing

* test cases

* test cases

* Merge branch 'feat/authentication-system' of https://github.com/reearth/reearth-backend into auth/mailer

# Conflicts:
#	go.mod
#	internal/app/config.go

* Merge branch 'feat/authentication-system' of https://github.com/reearth/reearth-backend into auth/mailer

# Conflicts:
#	go.mod

* swap plain and html contents

* switch to alternative

* remove unused functions

* validate email and smtp url
* - Model
- Repo

* - fix go mod

* - move auth storage logic to usecase\interactor

* - fix lint issue

* - fix PR comments

* implement memory storage for authRequest repo
* remove sugnup mutation

* new signup logic

* merge auth0 and signup logic

* lint

* revert signup mutation

* resolve notes

* remove password length

* resolve notes

* test cases

* change comparing method

* resolve notes

* match password

* update user data-layer

* feat: password reset (#79)

* - password reset

* - refactor

* - implement the memory repo

* - remove unnecessary structs

* - fix password reset token validation
- add unit test

* - fix linting

* - fix unit test

* - refactor

* - replace uuid lib
- rename validate method

* - fix go mod

* - fix go mod

* - enhance unit test

* - enhance unit test

* mock

Co-authored-by: rot1024 <aayhrot@gmail.com>

* feat: send mail (#86)

* - send mail

* enhancement

* fix log

* notes

* - add email design

* resolve

* fix user model

* refactor: move to bcrypt

* update verify password checks

Co-authored-by: yk-eukarya <81808708+yk-eukarya@users.noreply.github.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
Co-authored-by: yk <yk.eukarya@gmail.com>
* - save the key and the cert of auth server in mongo db

* - fix lint

* - make auth srv returns error instead of panicking

* - lock config

* - refactor
- fix memory imp

* - fix load method

* - fix load method

* - add minimum duration to reload config

* - fix pr comments

* - fix lock logic

* fix lint

* - fix config repo
- use config repo in migrations

* - remove unused code

* store cert as string

* fix string conversion
# Conflicts:
#	pkg/user/builder.go
#	pkg/user/builder_test.go
#	pkg/user/initializer_test.go
#	pkg/user/user.go
* upgrade to go-jwt-middleware/v2

* omp multi iss

* imp multi iss

* fix pr Comments
@yk-eukarya yk-eukarya changed the title Feat/authentication system feat: authentication system Feb 7, 2022
@codecov
Copy link

codecov bot commented Feb 7, 2022

Codecov Report

Merging #108 (da25f18) into main (db72827) will decrease coverage by 0.80%.
The diff coverage is 13.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   36.95%   36.14%   -0.81%     
==========================================
  Files         304      312       +8     
  Lines       27329    28447    +1118     
==========================================
+ Hits        10099    10283     +184     
- Misses      16303    17219     +916     
- Partials      927      945      +18     
Impacted Files Coverage Δ
internal/adapter/gql/resolver_mutation_user.go 0.00% <0.00%> (ø)
internal/app/app.go 0.00% <0.00%> (ø)
internal/app/auth_client.go 0.00% <ø> (ø)
internal/app/auth_server.go 0.00% <0.00%> (ø)
internal/app/config.go 0.00% <0.00%> (ø)
internal/app/jwt.go 0.00% <0.00%> (ø)
internal/app/main.go 0.00% <0.00%> (ø)
internal/app/public.go 33.56% <0.00%> (-16.44%) ⬇️
internal/app/repo.go 0.00% <0.00%> (ø)
internal/infrastructure/memory/auth_request.go 0.00% <0.00%> (ø)
... and 18 more

@yk-eukarya yk-eukarya self-assigned this Feb 9, 2022
mimoham24 and others added 4 commits March 4, 2022 10:36
* password criteria

* fix linter

* Update pkg/user/user.go

Co-authored-by: yk-eukarya <81808708+yk-eukarya@users.noreply.github.com>

* Update pkg/user/user.go

Co-authored-by: rot1024 <aayhrot@gmail.com>

* fix test

* add test case for non-latin characters password

Co-authored-by: yk-eukarya <81808708+yk-eukarya@users.noreply.github.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
# Conflicts:
#	go.mod
#	go.sum
#	internal/app/app.go
#	internal/app/public.go
Co-authored-by: yk-eukarya <81808708+yk-eukarya@users.noreply.github.com>
Co-authored-by: yk <yk.eukarya@gmail.com>
Co-authored-by: rot1024 <aayhrot@gmail.com>
@rot1024 rot1024 marked this pull request as ready for review March 11, 2022 07:05
@rot1024 rot1024 merged commit b89c323 into main Mar 11, 2022
@rot1024 rot1024 deleted the feat/authentication-system branch March 11, 2022 07:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants