siga

Sistema Interativo de GerĂȘncia de Atividades.
Log | Files | Refs | README | LICENSE

logout.go (345B)


      1 package main
      2 
      3 import (
      4 	"net/http"
      5 	"uuid"
      6 
      7 	"github.com/gboncoffee/siga/auth/repository"
      8 )
      9 
     10 func logout(w http.ResponseWriter, r *http.Request) {
     11 	token, err := uuid.Parse(r.PathValue("uuid"))
     12 	if err != nil {
     13 		http.Error(w, "invalid token", http.StatusBadRequest)
     14 		return
     15 	}
     16 
     17 	repository.DeleteSession(token)
     18 	w.WriteHeader(http.StatusOK)
     19 }