Skip to content

Commit

Permalink
fix non sign
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushikeshnimkar committed May 13, 2024
1 parent bf15093 commit 1786c15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/v1/authenticate/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func ApplyRoutes(r *gin.RouterGroup) {
{
g.POST("", authenticate)
g.Use(paseto.PASETO(false))
g.POST("/NonSign", authenticateNonSignature)
g.GET("", authenticateToken)
g.GET("/nonSign", authenticateNonSignature)

}
}

Expand Down Expand Up @@ -179,6 +180,7 @@ func authenticateNonSignature(c *gin.Context) {
httpo.NewErrorResponse(http.StatusBadRequest, fmt.Sprintf("payload is invalid: %s", err)).SendD(c)
return
}

//Get flowid type
var flowIdData models.FlowId
err = db.Model(&models.FlowId{}).Where("flow_id = ?", req.FlowId).First(&flowIdData).Error
Expand All @@ -187,6 +189,7 @@ func authenticateNonSignature(c *gin.Context) {
httpo.NewErrorResponse(http.StatusNotFound, "flow id not found").SendD(c)
return
}

if flowIdData.FlowIdType != models.AUTH {
httpo.NewErrorResponse(http.StatusBadRequest, "flow id not created for auth").SendD(c)
return
Expand Down

0 comments on commit 1786c15

Please sign in to comment.