• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gomniauth.WithProviders函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/stretchr/gomniauth.WithProviders函数的典型用法代码示例。如果您正苦于以下问题:Golang WithProviders函数的具体用法?Golang WithProviders怎么用?Golang WithProviders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了WithProviders函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	addr := flag.String("addr", ":8080", "address")
	flag.Parse()
	gomniauth.SetSecurityKey("key")
	gomniauth.WithProviders(
		github.New("clientid", "secretkey", "http://localhost:8080/auth/callback/github"),
	)

	http.HandleFunc("/1/0", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hoge"))
	})
	http.Handle("/1/1", &templateHandler{filename: "chat.html"})

	http.Handle("/2/1", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth", loginHandler)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)
	http.Handle("/1/2", r)
	go r.run()

	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:ntk1000,项目名称:go-web-book-playground,代码行数:26,代码来源:main.go


示例2: _main

func _main() {
	var addr = flag.String("addr", ":8080", "アプリケーションのアドレス")
	var callbackURL = flag.String("google-oauth-callback", "http://localhost:8080/auth/callback/google", "Google認証のコールバックURL")
	flag.Parse()

	gomniauth.SetSecurityKey(signature.RandomKey(64))
	gomniauth.WithProviders(
		google.New(os.Getenv("GOOGLE_OAUTH_CLIENT_ID"), os.Getenv("GOOGLE_OAUTH_CLIENT_SECRET"), *callbackURL),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)
	http.Handle("/chat", MustAuth(&templateHandler{filename: "index.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	go r.run()

	log.Println("Webサーバーを開始します。ポート: ", *addr)
	log.Println("Google認証のコールバックURL: ", *callbackURL)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
开发者ID:mosson,项目名称:chat-sample,代码行数:25,代码来源:main.go


示例3: main

func main() {
	var addr = flag.String("addr", ":8080", "アプリケーションのアドレス")
	flag.Parse()
	gomniauth.SetSecurityKey(signature.RandomKey(64))
	gomniauth.WithProviders(
		google.New(
			os.Getenv("client_id"),
			os.Getenv("client_secret"),
			"http://localhost:8080/auth/callback/google"))
	r := newRoom(UseFileSystemAvatar)
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) {
		http.SetCookie(w, &http.Cookie{
			Name:   "auth",
			Value:  "",
			Path:   "/",
			MaxAge: -1,
		})
		w.Header().Set("Location", "/chat")
		w.WriteHeader(http.StatusTemporaryRedirect)
	})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)
	http.Handle("/upload", &templateHandler{filename: "upload.html"})
	http.HandleFunc("/uploader", uploaderHandler)
	http.Handle("/avatars/",
		http.StripPrefix("/avatars/",
			http.FileServer(http.Dir("./avatars"))))
	go r.run()
	log.Println("Webサーバーを開始します。ポート: ", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:toromoti,项目名称:study-golang,代码行数:35,代码来源:main.go


示例4: main

func main() {

	var addr = flag.String("addr", ":8080", "The addr of the application.")
	flag.Parse()

	gomniauth.SetSecurityKey(os.Getenv("GOCHAT_SEC_KEY"))
	gomniauth.WithProviders(
		soundcloud.New(os.Getenv("ENV_SC_CLIENT_ID"), os.Getenv("ENV_SC_SECRET"), os.Getenv("ENV_SC_CALLBACK_URL")),
		github.New(os.Getenv("ENV_GH_CLIENT_ID"), os.Getenv("ENV_GH_SECRET"), os.Getenv("ENV_GH_CALLBACK_URL")),
	)

	r := newRoom(UseGravatar)
	r.tracer = trace.New(os.Stdout)

	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/logout", logoutHandler)
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)
	http.Handle("/upload", &templateHandler{filename: "upload.html"})
	http.HandleFunc("/uploader", uploaderHandler)

	http.Handle("/avatars/",
		http.StripPrefix("/avatars/",
			http.FileServer(http.Dir("./avatars/"))))

	go r.run()

	log.Println("Starting web server on ", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:mxjxn,项目名称:gochat,代码行数:33,代码来源:main.go


示例5: Initialize

// Initialize collects server-side credential from environment variables and prepare for authentication with Github OAuth.
//
// Client authentication is disabled and CurrentUser always returns "anonymous" if any of the environment variables are missing.
func Initialize(anynomous User, cookieSecret []byte) {
	store = sessions.NewCookieStore(cookieSecret)
	githubCallbackURL = os.Getenv("GITHUB_CALLBACK_URL")
	cred := struct {
		githubRandomHashKey string
		githubOmniauthID    string
		githubOmniauthKey   string
	}{
		os.Getenv("GITHUB_RANDOM_HASH_KEY"),
		os.Getenv("GITHUB_OMNI_AUTH_ID"),
		os.Getenv("GITHUB_OMNI_AUTH_KEY"),
	}
	defaultUser = anynomous

	if cred.githubRandomHashKey == "" || cred.githubOmniauthID == "" || cred.githubOmniauthKey == "" || githubCallbackURL == "" {
		log.Printf(
			"Missing one or more Gomniauth Environment Variables: Running with with limited functionality! \n githubRandomHashKey [%s] \n githubOmniauthID [%s] \n githubOmniauthKey[%s] \n githubCallbackURL[%s]",
			cred.githubRandomHashKey,
			cred.githubOmniauthID,
			cred.githubOmniauthKey,
			githubCallbackURL,
		)
		enabled = false
		return
	}
	githubCallbackURL = path.Join(githubCallbackURL, "/auth/github/callback")

	gomniauth.SetSecurityKey(cred.githubRandomHashKey)
	gomniauth.WithProviders(
		githubOauth.New(cred.githubOmniauthID, cred.githubOmniauthKey, githubCallbackURL),
	)
	enabled = true
}
开发者ID:cazacugmihai,项目名称:goship,代码行数:36,代码来源:auth.go


示例6: main

func main() {
	var addr = flag.String("addr", ":8080", "The addr of the application")
	flag.Parse()

	gomniauth.SetSecurityKey("wetre94541gd616fd1g6fd")
	gomniauth.WithProviders(
		facebook.New("1578364069092723", "3be3e79ef1c5a14a8d556d45ab28bc23",
			"http://localhost:8080/auth/callback/facebook"),
		google.New("773345955621-aj0hpvne7depi9er2cp72t2mrknb3l26.apps.googleusercontent.com", "zT2_36o-f18VxmmvdltT_9vX",
			"http://localhost:8080/auth/callback/google"),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHander)
	http.Handle("/room", r)

	//start the room in the background
	go r.run()

	//start the web server
	log.Println("Starting web server on", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:anand180,项目名称:go-blueprints,代码行数:28,代码来源:main.go


示例7: Initialize

// Initialize collects server-side credential from environment variables and prepare for authentication with Github OAuth.
//
// Client authentication is disabled and CurrentUser always returns "anonymous" if any of the environment variables are missing.
func Initialize(anynomous User, cookieSecret []byte) {
	store = sessions.NewCookieStore(cookieSecret)
	githubCallbackBase = os.Getenv("GITHUB_CALLBACK_URL")
	cred := struct {
		githubRandomHashKey string
		githubOmniauthID    string
		githubOmniauthKey   string
	}{
		os.Getenv("GITHUB_RANDOM_HASH_KEY"),
		os.Getenv("GITHUB_OMNI_AUTH_ID"),
		os.Getenv("GITHUB_OMNI_AUTH_KEY"),
	}
	defaultUser = anynomous

	if cred.githubRandomHashKey == "" || cred.githubOmniauthID == "" || cred.githubOmniauthKey == "" || githubCallbackBase == "" {
		glog.Warningf(
			"Missing one or more Gomniauth Environment Variables: Running with with limited functionality! \n GITHUB_RANDOM_HASH_KEY [%s] \n GITHUB_OMNI_AUTH_ID [%s] \n GITHUB_OMNI_AUTH_KEY [%s] \n GITHUB_CALLBACK_URL [%s]",
			cred.githubRandomHashKey,
			cred.githubOmniauthID,
			cred.githubOmniauthKey,
			githubCallbackBase,
		)
		enabled = false
		return
	}
	url := fmt.Sprintf("%s/auth/github/callback", githubCallbackBase)

	gomniauth.SetSecurityKey(cred.githubRandomHashKey)
	gomniauth.WithProviders(
		githubOauth.New(cred.githubOmniauthID, cred.githubOmniauthKey, url),
	)
	glog.Infof("Enabled authentication by github OAuth2")
	enabled = true
}
开发者ID:kgrvamsi,项目名称:goship,代码行数:37,代码来源:auth.go


示例8: main

func main() {
	var addr = flag.String("addr", ":8080", "アプリケーションのアドレス")
	flag.Parse() // フラグを解釈します
	// Gomniauthのセットアップ
	gomniauth.SetSecurityKey("セキュリティキー")
	gomniauth.WithProviders(
		facebook.New("クライアントID", "秘密の値", "http://localhost:8080/auth/callback/facebook"),
		github.New("クライアントID", "秘密の値", "http://localhost:8080/auth/callback/github"),
		google.New("クライアントID", "秘密の値", "http://localhost:8080/auth/callback/google"),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)
	// チャットルームを開始します
	go r.run()
	// Webサーバーを起動します
	log.Println("Webサーバーを開始します。ポート: ", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:ukai,项目名称:go-programming-blueprints,代码行数:25,代码来源:main.go


示例9: main

func main() {

	flag.Parse() // parse the flags

	// setup gomniauth
	gomniauth.SetSecurityKey("98dfbg7iu2nb4uywevihjw4tuiyub34noilk")
	gomniauth.WithProviders(
		github.New("3d1e6ba69036e0624b61", "7e8938928d802e7582908a5eadaaaf22d64babf1", "http://localhost:8080/auth/callback/github"),
		google.New("44166123467-o6brs9o43tgaek9q12lef07bk48m3jmf.apps.googleusercontent.com", "rpXpakthfjPVoFGvcf9CVCu7", "http://localhost:8080/auth/callback/google"),
		facebook.New("537611606322077", "f9f4d77b3d3f4f5775369f5c9f88f65e", "http://localhost:8080/auth/callback/facebook"),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)

	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	// get the room going
	go r.run()

	// start the web server
	log.Println("Starting web server on", *host)
	if err := http.ListenAndServe(*host, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}

}
开发者ID:0-T-0,项目名称:goblueprints,代码行数:30,代码来源:main.go


示例10: setUpProvider

func setUpProvider() {
	// setup the providers
	gomniauth.SetSecurityKey(MySecurityKey)
	gomniauth.WithProviders(
		google.New(GoogleClientId, GoogleSecret, "http://localhost:8080/auth/google/callback"),
	)
}
开发者ID:goofiw,项目名称:carpooliogo,代码行数:7,代码来源:authHandler.go


示例11: main

func main() {
	var addr = flag.String("addr", ":18080", "アプリケーションのアドレス")
	flag.Parse() // フラグを解釈します

	// Gomniauth のセットアップ
	gomniauth.SetSecurityKey("RESIDENCE101")
	gomniauth.WithProviders(
		facebook.New("957653387645069", "bd4b9984868d78cb2012b4554a6c61a8", "http://localhost:18080/auth/callback/facebook"),
		github.New("60c22ff289a776f58746", "cd1581d547e80cfc01586bdfd343317a8b9e3f65", "http://localhost:18080/auth/callback/github"),
		google.New("940801949020-9b6d4r5emh1k6ds9mmmiq1esdt669mrs.apps.googleusercontent.com", "jd3H38hVee1Ragcx0UzStHoW", "http://localhost:18080/auth/callback/google"),
	)

	r := newRoom()
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	// チャットルームを開始します
	go r.run()

	// Web サーバーを開始します
	log.Println("Web サーバーを開始します。ポート: ", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:masutaka,项目名称:goblueprints,代码行数:27,代码来源:main.go


示例12: main

func main() {
	var addr = flag.String("addr", ":8080", "The addr of the application.")
	// set up gomniauth
	gomniauth.SetSecurityKey("lfq618")
	gomniauth.WithProviders(
		facebook.New("608517422619964", "ff3966474a0e0925419a57cd79776bdd", "http://localhost:8080/auth/callback/facebook"),
		github.New("6f6ab375ab58c83ce223", "20e565a7e13d235c60ede23a26d33bd8a735e03a", "http://localhost:8080/auth/callback/github"),
		google.New("507301202565-k1drgkq7v6u5b42fk849k90pm33b3van.apps.googleusercontent.com", "EmPZvBUVc1-Tc5fWQ4gjSh78", "http://localhost:8080/auth/callback/google"),
	)

	r := newRoom()
	//r.tracer = trace.New(os.Stdout)

	//root
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	//get the room goint
	go r.run()

	//start the web server
	log.Println("Starting web server on", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:lfq618,项目名称:golearn,代码行数:28,代码来源:main.go


示例13: main

func main() {
	var addr = flag.String("addr", ":8080", "The addr of the application.")
	flag.Parse() // parse the flags
	gomniauth.SetSecurityKey("some long key")
	gomniauth.WithProviders(
		facebook.New("key", "secret", "http://localhost:8080/auth/callback/facebook"),
		github.New("key", "secret", "http://localhost:8080/auth/callback/github"),
		google.New("key", "secret", "http://localhost:8080/auth/callback/google"),
	)
	r := newRoom()
	r.tracer = trace.New(os.Stdout)

	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	// get the room going
	go r.run()

	// start the web server
	log.Println("Starting web server on", *addr)
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}

}
开发者ID:jplesperance,项目名称:go-learning-projects,代码行数:27,代码来源:main.go


示例14: main

func main() {
	var addr = flag.String("addr", ":8080", "app address")
	flag.Parse()

	gomniauth.SetSecurityKey(signature.RandomKey(64))
	gomniauth.WithProviders(
		google.New("391625238451-97uhiqpmehlvmgc48f5dscu2qi933v4l.apps.googleusercontent.com", "eqjo3wv_tXr6i9FJlgFiYRKD", "http://localhost:8080/auth/callback/google"),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)
	// http.Handle("/", &templateHandler{filename: "chat.html"})
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) {
		http.SetCookie(w, &http.Cookie{
			Name:   "auth",
			Value:  "",
			Path:   "/",
			MaxAge: -1,
		})
		w.Header()["Location"] = []string{"/chat"}
		w.WriteHeader(http.StatusTemporaryRedirect)
	})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	go r.run()

	log.Println("launching server port :", *addr)

	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:TakaakiFuruse,项目名称:go_practice,代码行数:35,代码来源:main.go


示例15: getAuth

//  Authenticate with Github. If env data is missing turn Auth off.
func getAuth() auth {
	a := auth{}
	a.githubRandomHashKey = os.Getenv("GITHUB_RANDOM_HASH_KEY")
	a.githubOmniauthID = os.Getenv("GITHUB_OMNI_AUTH_ID")
	a.githubOmniauthKey = os.Getenv("GITHUB_OMNI_AUTH_KEY")
	a.githubCallbackURL = os.Getenv("GITHUB_CALLBACK_URL")
	// Let user know if a key is missing and that auth is disabled.

	if a.githubRandomHashKey == "" || a.githubOmniauthID == "" || a.githubOmniauthKey == "" || a.githubCallbackURL == "" {
		log.Printf("Missing one or more Gomniauth Environment Variables: Running with with limited functionality! \n githubRandomHashKey [%s] \n githubOmniauthID [%s] \n githubOmniauthKey[%s] \n githubCallbackURL[%s]",
			a.githubRandomHashKey,
			a.githubOmniauthID,
			a.githubOmniauthKey,
			a.githubCallbackURL)
		a.authorization = false
		return a
	}

	gomniauth.SetSecurityKey(a.githubRandomHashKey)
	gomniauth.WithProviders(
		githubOauth.New(a.githubOmniauthID, a.githubOmniauthKey, a.githubCallbackURL+"/auth/github/callback"),
	)
	a.authorization = true
	return a
}
开发者ID:cinderalla,项目名称:goship,代码行数:26,代码来源:goship.go


示例16: main

func main() {
	addr := flag.String("addr", ":8080", "アプリケーションのアドレス")
	flag.Parse()

	gomniauth.SetSecurityKey("GoChat")
	gomniauth.WithProviders(
		google.New(googleClientID, googleSecret, "http://localhost:8080/auth/callback/google"),
	)

	r := newRoom()
	r.tracer = trace.New(os.Stdout)

	// http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {w.Write([]byte())})
	// http.Handle("/assets/", http.StripPrefix("/assets", http.FileServer(http.Dir("/assetsへのパス"))))
	// *templateHandler型(templateHandlerのポインタ型)にServeHTTPが実装されている
	// のでtemplateHandlerのアドレスを渡してポインタである*templateHandler型を渡す
	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)

	go r.run()

	log.Println("Webサーバを開始します。ポート: ", *addr)

	// start web server
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:bonegollira,项目名称:gogo,代码行数:30,代码来源:main.go


示例17: init

func init() {
	// gomniauth 정보 셋팅
	gomniauth.SetSecurityKey(authSecurityKey)
	gomniauth.WithProviders(
		google.New("636296155193-a9abes4mc1p81752l116qkr9do6oev3f.apps.googleusercontent.com", "EVvuy0Agv4jWflml0pvC6-vI",
			"http://127.0.0.1:3000/auth/callback/google"),
	)
}
开发者ID:RorNHJ,项目名称:GoLanguage,代码行数:8,代码来源:auth.go


示例18: init

func init() {

	gomniauth.SetSecurityKey(signature.RandomKey(64))
	gomniauth.WithProviders(
		google.New("712450255947-o5uppfp82sc3sb2c1dum7es8k93ras4q.apps.googleusercontent.com", "TrFX1I5QJZ_unJ-P5UgYLF4N", PalvelimenOsoite+"/authcallback/google"),
	)

	gob.Register(User{})
}
开发者ID:joonazan,项目名称:go-opas,代码行数:9,代码来源:login.go


示例19: main

func main() {
	// The de nition for the addr variable sets up our flag
	// as a string that defaults to :8080
	addr := flag.String("addr", ":8080", "The addr of the application.")
	// must call flag. Parse() that parses the arguments
	// and extracts the appropriate information.
	// Then, we can reference the value of the host  ag by using *addr.
	flag.Parse() // parse the flags

	// set up gomniauth
	gomniauth.SetSecurityKey("some long key")
	gomniauth.WithProviders(
		facebook.New("key", "secret", ""),
		github.New("key", "secret", ""),
		google.New("151570833065-i9p63mogjm7adt0h0490or9bvqua0r2l.apps.googleusercontent.com",
			"jzEEORYarixD30S6qyosGrWe",
			"http://localhost:3000/auth/callback/google"),
	)

	//	r := newRoom(UseAuthAvatar)
	//	r := newRoom(UseGravatar)
	r := newRoom(UseFileSystemAvatar)
	r.tracer = trace.New(os.Stdout)

	http.Handle("/chat", MustAuth(&templateHandler{filename: "chat.html"}))
	http.Handle("/login", &templateHandler{filename: "login.html"})
	http.HandleFunc("/auth/", loginHandler)
	http.Handle("/room", r)
	http.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) {
		http.SetCookie(w, &http.Cookie{
			Name:   "auth",
			Value:  "",
			Path:   "/",
			MaxAge: -1,
		})
		w.Header()["Location"] = []string{"/chat"}
		w.WriteHeader(http.StatusTemporaryRedirect)
	})
	http.Handle("/upload", &templateHandler{filename: "upload.html"})
	http.HandleFunc("/uploader", uploaderHandler)
	http.Handle("/avatars/",
		http.StripPrefix("chapter2/chat/avatars/",
			http.FileServer(http.Dir("./avatars"))))

	// get the room going
	// running the room in a separate Go routine
	// so that the chatting operations occur in the background,
	// allowing our main thread to run the web server.
	go r.run()
	// start the web server
	log.Println("Starting web server on", *addr)
	// start the web server
	if err := http.ListenAndServe(*addr, nil); err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}
开发者ID:rabbitcount,项目名称:goblueprints,代码行数:56,代码来源:main.go


示例20: getAuthProvider

func (a *defaultAuthenticator) getAuthProvider(r *http.Request, providerName string) (common.Provider, error) {
	gomniauth.WithProviders(
		google.New(a.cfg.GoogleClientID,
			a.cfg.GoogleSecret,
			getBaseURL(r)+"/api/auth/oauth2/google/callback/",
		),
	)
	provider, err := gomniauth.Provider(providerName)
	if err != nil {
		return provider, errgo.Mask(err)
	}
	return provider, nil
}
开发者ID:sandbreaker,项目名称:photoshare,代码行数:13,代码来源:auth.go



注:本文中的github.com/stretchr/gomniauth.WithProviders函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang common.Credentials类代码示例发布时间:2022-05-28
下一篇:
Golang gomniauth.SetSecurityKey函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap