Files
simrsx-be/internal/lib/sync-credential/helper.go
Munawwirul Jamal b09c9f183c feat/sync-setting:
+ moved infra/sync-cfg to infra/sync-consumer-cfg
+ adjut anything related to old infra/sync
+ infra/sync is now have new setting for the sync
2025-11-28 09:16:38 +07:00

24 lines
601 B
Go

package authentication
import (
"net/http"
d "github.com/karincake/dodol"
rw "github.com/karincake/risoles"
sr "github.com/karincake/serabi"
e "simrs-vx/internal/domain/sync-entities/authentication"
)
func CheckCredentialData(input *e.CredentialDto, r *http.Request, w http.ResponseWriter) bool {
input.Source = r.Header.Get("X-Sync-Source")
input.SecretKey = r.Header.Get("X-Sync-SecretKey")
input.UserName = r.Header.Get("X-Sync-UserName")
if err := sr.Validate(input); err != nil {
rw.WriteJSON(w, http.StatusUnauthorized, d.II{"errors": err}, nil)
return false
}
return true
}