OAuth

/app/lib/auth/service.go (433 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package auth

import (
"{{{ .Package }}}/app/util"
)

type Service struct {
baseURL string
port uint16
providers Providers
}

func NewService(baseURL string, port uint16, logger util.Logger) *Service {
ret := &Service{baseURL: baseURL, port: port}
_ = ret.load(logger)
return ret
}

func (s *Service) LoginURL() string {
if len(s.providers) == 1 {
return "/auth/" + s.providers[0].ID
}
return defaultProfilePath
}