feat/sync-setting: TODO to get credential
This commit is contained in:
@@ -75,13 +75,14 @@ func GuardMW(next http.Handler) http.Handler {
|
||||
credential.SecretKey = r.Header.Get("X-Sync-SecretKey")
|
||||
credential.UserName = r.Header.Get("X-Sync-UserName")
|
||||
if credential.Source != "" || credential.SecretKey != "" || credential.UserName != "" {
|
||||
ctx := context.WithValue(r.Context(), esga.SyncKey{}, credential)
|
||||
// TODO: ngecall fungsi untuk dapat dari DB menlengkapi authinfo
|
||||
accessDetail, err := s.GetAuthInfoByUserName(credential.UserName)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, err.(d.FieldError), nil)
|
||||
return
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), pa.AuthKey{}, accessDetail)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
// TO DO:
|
||||
// 1 Get user info manually (not by using token), based on credential.UserName
|
||||
// 2 To cover the point 1, Adjust /use-case/main-use-case/authentication to have the function
|
||||
// 3 Any DTO that is used in the sync, add flag Sync (tru/false), set it true if it is from sync
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user