Documentation ¶
Index ¶
- Variables
- func CheckerApprove(requestID string, iIDFromHeader string, userID string, level string) (bool, error)
- func ExtractJWTClaims(tokenStr string, r *http.Request) (jwt.MapClaims, bool)
- func HasEndpoint(claims jwt.MapClaims, enpTarget string) bool
- func HasIP(claims jwt.MapClaims, remoteAddrs []string) bool
- func IsForParticipant(claims jwt.MapClaims) bool
- func MakerRequest(participantID string, institutionID string, path string, method string, ...) (string, error)
- type MakerRequestData
Constants ¶
This section is empty.
Variables ¶
var LOGGER = logging.MustGetLogger("middlewares")
LOGGER for logging
Functions ¶
func CheckerApprove ¶
func CheckerApprove(requestID string, iIDFromHeader string, userID string, level string) (bool, error)
CheckerApprove : After authorization, this is used for approving the request (internal) and making changes in firebase approvals node.
func ExtractJWTClaims ¶
ExtractJWTClaims : parses (decodes) jwt token using secret and returns claims if successful
func HasEndpoint ¶
HasEndpoint : check if requested endpoint is included in endpoint array
func IsForParticipant ¶
func IsForParticipant(claims jwt.MapClaims) bool
IsForParticipant : if service is not a singleton then check if the token participant matches the participant id per the env var
func MakerRequest ¶
func MakerRequest(participantID string, institutionID string, path string, method string, level string, userID string) (string, error)
* MakerRequest : After authorization, write the request to firebase in approvals (participant_approvals/super_approvals) node *@param{ w: http response writer, r: http request, level: string , userID: string }
Types ¶
type MakerRequestData ¶
type MakerRequestData struct { RequestUserID string `json:"uid_request,omitempty"` ApproveUserID string `json:"uid_approve"` InstitutionID string `json:"iid,omitempty"` ParticipantID string `json:"pid,omitempty"` Status string `json:"status,omitempty"` Endpoint string `json:"endpoint,omitempty"` Method string `json:"method,omitempty"` Timestamp int64 `json:"timestamp_request,omitempty"` }
MakerRequestData is a json-serializable type. This is the data structure that gets committed to firebase. The ApproveUserId is added from the beginning since altering types later is not possible.