security/controller.go
func (c *OAuth2Controller) Authorize(w http.ResponseWriter, r *http.Request) {
	clientID := r.URL.Query().Get("client_id")
	responsetype := r.URL.Query().Get("response_type")
	redirectURI := r.URL.Query().Get("redirect_uri")
	userID := r.URL.Query().Get("user_id")
	if len(redirectURI) == 0 {
		app, _ := c.ApplicationManager.GetByClientID(clientID)
		redirectURI = app.Callback
	}
	if len(redirectURI) == 0 {
		log.Print("Pas de paramètre redirect_uri")
		// return an error code ?
	} else {
		if strings.Compare(responsetype, "code") == 0 {
			code, err := EncodeOAuth2Code(clientID, redirectURI, userID, c.cnf.Jwt.Key)
			if err != nil {
				log.Printf("Error: %v", err)
			}
			data := map[string]string{
				"redirectURI": redirectURI,
				"code":        code,
			}
			js, _ := json.Marshal(data)
			w.Write(js)
		} else {
			log.Print("Pas de paramètre code")
			//return a Token
		}
	}
}
func (c *OAuth2Controller) Authorize(w http.ResponseWriter, r *http.Request) {
	clientID := r.URL.Query().Get("client_id")
	responsetype := r.URL.Query().Get("response_type")
	redirectURI := r.URL.Query().Get("redirect_uri")
	userID := r.URL.Query().Get("user_id")
	if len(redirectURI) == 0 {
		app, _ := c.ApplicationManager.GetByClientID(clientID)
		redirectURI = app.Callback
	}
	if len(redirectURI) == 0 {
		log.Print("Pas de paramètre redirect_uri")
		// return an error code ?
	} else {
		if strings.Compare(responsetype, "code") == 0 {
			code, err := EncodeOAuth2Code(clientID, redirectURI, userID, c.cnf.Jwt.Key)
			if err != nil {
				log.Printf("Error: %v", err)
			}
			data := map[string]string{
				"redirectURI": redirectURI,
				"code":        code,
			}
			js, _ := json.Marshal(data)
			w.Write(js)
		} else {
			log.Print("Pas de paramètre code")
			//return a Token
		}
	}
}
//Authorize user