Authentication code is in auth now

This commit is contained in:
Eduard Urbach 2017-06-17 01:32:47 +02:00
parent 88614d412b
commit 4ab152d976
4 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
package main package auth
import ( import (
"encoding/json" "encoding/json"

View File

@ -1,11 +1,11 @@
package main package auth
import "github.com/aerogo/aero" import "github.com/aerogo/aero"
// EnableLogin ... // Install ...
func EnableLogin(app *aero.Application) { func Install(app *aero.Application) {
// Google // Google
EnableGoogleLogin(app) InstallGoogleAuth(app)
// Logout // Logout
app.Get("/logout", func(ctx *aero.Context) string { app.Get("/logout", func(ctx *aero.Context) string {

View File

@ -1,4 +1,4 @@
package main package auth
import ( import (
"encoding/json" "encoding/json"
@ -25,8 +25,8 @@ type GoogleUser struct {
Gender string `json:"gender"` Gender string `json:"gender"`
} }
// EnableGoogleLogin enables Google login for the app. // InstallGoogleAuth enables Google login for the app.
func EnableGoogleLogin(app *aero.Application) { func InstallGoogleAuth(app *aero.Application) {
conf := &oauth2.Config{ conf := &oauth2.Config{
ClientID: apiKeys.Google.ID, ClientID: apiKeys.Google.ID,
ClientSecret: apiKeys.Google.Secret, ClientSecret: apiKeys.Google.Secret,

View File

@ -4,6 +4,7 @@ import (
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/aerogo/api" "github.com/aerogo/api"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/auth"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/layout" "github.com/animenotifier/notify.moe/layout"
"github.com/animenotifier/notify.moe/middleware" "github.com/animenotifier/notify.moe/middleware"
@ -66,7 +67,7 @@ func main() {
} }
// Authentication // Authentication
EnableLogin(app) auth.Install(app)
// Let's go // Let's go
app.Run() app.Run()