databag/net/server/internal/api_authorize.go

34 lines
756 B
Go
Raw Normal View History

2022-01-11 06:20:32 +00:00
/*
* DataBag
*
* DataBag provides storage for decentralized identity based self-hosting apps. It is intended to support sharing of personal data and hosting group conversations.
*
* API version: 0.0.1
* Contact: roland.osborne@gmail.com
2022-01-13 05:00:52 +00:00
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
2022-01-11 06:20:32 +00:00
*/
package databag
import (
"net/http"
)
2022-01-13 05:23:18 +00:00
func Authorize(w http.ResponseWriter, r *http.Request) {
account, res := BearerAppToken(r);
PrintMsg(res);
PrintMsg(account);
if res != nil {
w.WriteHeader(http.StatusUnauthorized)
return
}
if account.Disabled {
w.WriteHeader(http.StatusGone);
return
}
2022-01-11 06:20:32 +00:00
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}