Esempio n. 1
0
// CallbackHandler handles Tumblr callback requests by parsing the oauth token
// and verifier and adding the Tubmlr access token and User to the ctx. If
// authentication succeeds, handling delegates to the success handler,
// otherwise to the failure handler.
func CallbackHandler(config *oauth1.Config, cookieConfig gologin.CookieConfig, success, failure ctxh.ContextHandler) ctxh.ContextHandler {
	// oauth1.CookieTempHandler -> oauth1.CallbackHandler -> TumblrHandler -> success
	success = tumblrHandler(config, success, failure)
	success = oauth1Login.CallbackHandler(config, success, failure)
	return oauth1Login.CookieTempHandler(cookieConfig, success, failure)
}
Esempio n. 2
0
// LoginHandler handles Tumblr login requests by obtaining a request token,
// setting a temporary token secret cookie, and redirecting to the
// authorization URL.
func LoginHandler(config *oauth1.Config, cookieConfig gologin.CookieConfig, failure ctxh.ContextHandler) ctxh.ContextHandler {
	// oauth1.LoginHandler -> oauth1.CookieTempHander -> oauth1.AuthRedirectHandler
	success := oauth1Login.AuthRedirectHandler(config, failure)
	success = oauth1Login.CookieTempHandler(cookieConfig, success, failure)
	return oauth1Login.LoginHandler(config, success, failure)
}