mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-07 21:08:12 +00:00
1382ab41e7
* wip * fix: fix util imports * fix: fix bootstrap import issues * fix: fix cli imports * fix: context controller * fix: use new context in user controller * fix: fix imports and context in proxy controller * fix: fix oauth and oidc controller imports and context * feat: finalize context functionality * refactor: simplify acls checking logic by passing the entire acl struct * chore: rename get basic auth to encode basic auth for clarity * fix: fix controller tests * tests: fix service tests * tests: fix utils tests * tests: move to testify for testing in utils * fix: fix config reference generator * tests: add tests for context parsing * tests: add tests for context middleware * tests: remove error wrapper from context tests * tests: fix log wrapper tests * fix: fix verion setting in cd and dockerfiles * fix: review comments batch 1 * fix: review comments batch 2 * fix: review comments batch 3 * fix: delete totp pending session cookie on totp success * tests: fix user controller tests * fix: don't audit login too early * fix: own comments
24 lines
786 B
Go
24 lines
786 B
Go
package service
|
|
|
|
import (
|
|
"github.com/tinyauthapp/tinyauth/internal/model"
|
|
"golang.org/x/oauth2/endpoints"
|
|
)
|
|
|
|
func newGoogleOAuthService(config model.OAuthServiceConfig) *OAuthService {
|
|
scopes := []string{"openid", "email", "profile"}
|
|
config.Scopes = scopes
|
|
config.AuthURL = endpoints.Google.AuthURL
|
|
config.TokenURL = endpoints.Google.TokenURL
|
|
config.UserinfoURL = "https://openidconnect.googleapis.com/v1/userinfo"
|
|
return NewOAuthService(config, "google")
|
|
}
|
|
|
|
func newGitHubOAuthService(config model.OAuthServiceConfig) *OAuthService {
|
|
scopes := []string{"read:user", "user:email"}
|
|
config.Scopes = scopes
|
|
config.AuthURL = endpoints.GitHub.AuthURL
|
|
config.TokenURL = endpoints.GitHub.TokenURL
|
|
return NewOAuthService(config, "github").WithUserinfoExtractor(githubExtractor)
|
|
}
|