mirror of
https://github.com/kataras/iris.git
synced 2025-12-23 04:47:02 +00:00
New feature: Auth support for social networks, dropbox, amazon and so on. Untested
https://github.com/iris-contrib/goth/ is the main package which has been converted to work with Iris from the ... https://github.com/markbates/goth/ . Not yet tested on real application.
This commit is contained in:
32
context.go
32
context.go
@@ -11,6 +11,16 @@ import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/iris-contrib/formBinder"
|
||||
"github.com/iris-contrib/goth"
|
||||
"github.com/iris-contrib/goth/gothic"
|
||||
"github.com/kataras/iris/config"
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/errors"
|
||||
"github.com/kataras/iris/sessions/store"
|
||||
"github.com/kataras/iris/utils"
|
||||
"github.com/klauspost/compress/gzip"
|
||||
"github.com/valyala/fasthttp"
|
||||
"html/template"
|
||||
"io"
|
||||
"net"
|
||||
@@ -22,15 +32,6 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/iris-contrib/formBinder"
|
||||
"github.com/kataras/iris/config"
|
||||
"github.com/kataras/iris/context"
|
||||
"github.com/kataras/iris/errors"
|
||||
"github.com/kataras/iris/sessions/store"
|
||||
"github.com/kataras/iris/utils"
|
||||
"github.com/klauspost/compress/gzip"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -781,3 +782,16 @@ func (ctx *Context) SendMail(subject string, body string, to ...string) error {
|
||||
func (ctx *Context) Log(format string, a ...interface{}) {
|
||||
ctx.framework.Logger.Printf(format, a...)
|
||||
}
|
||||
|
||||
/* Auth */
|
||||
|
||||
// CompleteUserAuth does what it says on the tin. It completes the authentication
|
||||
// process and fetches all of the basic information about the user from the provider.
|
||||
//
|
||||
// It expects to be able to get the name of the provider from the named parameters
|
||||
// as either "provider" or ":provider".
|
||||
//
|
||||
// See https://github.com/iris-contrib/goth/examples/main.go to see this in action.
|
||||
func (ctx *Context) CompleteUserAuth() (goth.User, error) {
|
||||
return gothic.CompleteUserAuth(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user