Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CompleteUserAuth = func(ctx iris.Context) (goth.User, error) { providerName, err := GetProviderName(ctx) if err != nil { return goth.User{}, err } provider, err := goth.GetProvider(providerName) if err != nil { return goth.User{}, err } session := sessionsManager.Start(ctx) value := session.GetString(providerName) if value == "" { return goth.User{}, errors.New("session value for " + providerName + " not found") } sess, err := provider.UnmarshalSession(value) if err != nil { return goth.User{}, err } user, err := provider.FetchUser(sess) if err == nil { return user, err } _, err = sess.Authorize(provider, ctx.Request().URL.Query()) if err != nil { return goth.User{}, err } session.Set(providerName, sess.Marshal()) return provider.FetchUser(sess) }
View Source
var GetProviderName = func(ctx iris.Context) (string, error) { if p := ctx.URLParam("provider"); p != "" { return p, nil } if p := ctx.Params().Get("provider"); p != "" { return p, nil } if p := ctx.Values().GetString("provider"); p != "" { return p, nil } return "", errors.New("you must select a provider") }
View Source
var SetState = func(ctx iris.Context) string { state := ctx.URLParam("state") if len(state) > 0 { return state } return "state" }
Functions ¶
func BeginAuthHandler ¶
Types ¶
type ProviderIndex ¶
func NewProviders ¶
func NewProviders() *ProviderIndex
type TypeServer ¶
type TypeServer struct {
PSQL *psql.TypePSQL
Redis *rds.TypeRedis
App *iris.Application
Providers *ProviderIndex
}
func New ¶
func New() *TypeServer
func (*TypeServer) Routing ¶
func (s *TypeServer) Routing()
Click to show internal directories.
Click to hide internal directories.