// ProxyCallback redirects the user back to proxy service along with an encrypted payload, as
// url params, of the user's session state as specified in RFC6749 3.1.2.
// https://tools.ietf.org/html/rfc6749#section-3.1.2
ProxyCallback redirects the user back to proxy service along with an encrypted payload, as
url params, of the user's session state as specified in RFC6749 3.1.2.
// ProxyCallback redirects the user back to proxy service along with an encrypted payload as // url params of the user ' s session state as specified in RFC6749 3 . 1 . 2 . // https : // tools . ietf . org / html / rfc6749#section - 3 . 1 . 2
func (a *Authenticate) ProxyCallback(w http.ResponseWriter, r *http.Request, session *sessions.SessionState) {
	err := r.ParseForm()
	if err != nil {
		httputil.ErrorResponse(w, r, err.Error(), http.StatusInternalServerError)
		return
	}
	state := r.Form.Get("state")
	if state == "" {
		httputil.ErrorResponse(w, r, "no state parameter supplied", http.StatusForbidden)
		return
	}
	redirectURI := r.Form.Get("redirect_uri")
	if redirectURI == "" {
		httputil.ErrorResponse(w, r, "no redirect_uri parameter supplied", http.StatusForbidden)
		return
	}
	redirectURL, err := url.Parse(redirectURI)
	if err != nil {
		httputil.ErrorResponse(w, r, "malformed redirect_uri parameter passed", http.StatusBadRequest)
		return
	}
	encrypted, err := sessions.MarshalSession(session, a.cipher)
	if err != nil {
		httputil.ErrorResponse(w, r, err.Error(), http.StatusInternalServerError)
		return
	}
	http.Redirect(w, r, getAuthCodeRedirectURL(redirectURL, state, string(encrypted)), http.StatusFound)
}
func ( a * Authenticate ) ProxyCallback ( w http . ResponseWriter , r * http . Request , session * sessions . SessionState ) { err := r . ParseForm ( ) if err != nil { httputil . ErrorResponse ( w , r , err . Error ( ) , http . StatusInternalServerError ) return } state := r . Form . Get ( " " ) if state == " " { httputil . ErrorResponse ( w , r , " " , http . StatusForbidden ) return } redirectURI := r . Form . Get ( " " ) if redirectURI == " " { httputil . ErrorResponse ( w , r , " " , http . StatusForbidden ) return } redirectURL , err := url . Parse ( redirectURI ) if err != nil { httputil . ErrorResponse ( w , r , " " , http . StatusBadRequest ) return } encrypted , err := sessions . MarshalSession ( session , a . cipher ) if err != nil { httputil . ErrorResponse ( w , r , err . Error ( ) , http . StatusInternalServerError ) return } http . Redirect ( w , r , getAuthCodeRedirectURL ( redirectURL , state , string ( encrypted ) ) , http . StatusFound ) }
ProxyCallback redirects the user back to proxy service along with an encrypted payload, as
url params, of the user's session state as specified in RFC6749 3.1.2.
ProxyCallback redirects the user back to proxy service along with an encrypted payload as url params of the user ' s session state as specified in RFC6749 3 . 1 . 2 .
// original `state` parameter received from the proxy application. // redirect url of proxy-service // encrypt session state as json blob