1
0
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:
Makis Maropoulos
2016-06-22 04:22:12 +03:00
parent 74bbc34d5b
commit 70b5e3d090
3 changed files with 53 additions and 14 deletions

View File

@@ -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)
}