Skip to content

Commit d2601c1

Browse files
committed
Update utils dependency to v0.4.0 and modify token creation to include expiration duration
1 parent 1fb5188 commit d2601c1

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require github.com/mattn/go-sqlite3 v1.14.24
66

77
require (
88
github.com/L4B0MB4/EVTSRC v0.5.3 // indirect
9-
github.com/PRYVT/utils v0.3.0 // indirect
9+
github.com/PRYVT/utils v0.4.0 // indirect
1010
github.com/bytedance/sonic v1.12.2 // indirect
1111
github.com/bytedance/sonic/loader v0.2.0 // indirect
1212
github.com/cloudwego/base64x v0.1.4 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ github.com/PRYVT/utils v0.2.1 h1:GiTbziM3lqRLc4EWGV28+T/aKaY+B80KTqnkBklf9q0=
4848
github.com/PRYVT/utils v0.2.1/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w=
4949
github.com/PRYVT/utils v0.3.0 h1:E0q08Gba+TdIsflKBA2XJLEE/RqbB8u3oXxy1wM7l+s=
5050
github.com/PRYVT/utils v0.3.0/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w=
51+
github.com/PRYVT/utils v0.4.0 h1:RQ7u6sunsic1EfZqOiaZDZvPEJwyx/DlPWqdFlgZHwM=
52+
github.com/PRYVT/utils v0.4.0/go.mod h1:G48oYenFuXUKVVA0sE/lmJlOwHGRacKH/9dNNae0DTk=
5153
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
5254
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
5355
github.com/bytedance/sonic v1.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg=

pkg/query/eventhandling/user.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/L4B0MB4/EVTSRC/pkg/models"
55
"github.com/L4B0MB4/PRYVT/identification/pkg/aggregates"
66
"github.com/L4B0MB4/PRYVT/identification/pkg/query/store/repository"
7+
"github.com/PRYVT/utils/pkg/interfaces"
78
"github.com/google/uuid"
89
"github.com/rs/zerolog/log"
910
)
@@ -18,6 +19,10 @@ func NewUserEventHandler(userRepo *repository.UserRepository) *UserEventHandler
1819
}
1920
}
2021

22+
func (eh *UserEventHandler) AddWebsocketConnection(conn interfaces.WebsocketConnecter) {
23+
log.Warn().Msg("Websocket connection not yet supported for user events")
24+
}
25+
2126
func (eh *UserEventHandler) HandleEvent(event models.Event) error {
2227
if event.AggregateType == "user" {
2328
ua, err := aggregates.NewUserAggregate(uuid.MustParse(event.AggregateId))

pkg/query/httphandler/controller/user_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller
22

33
import (
44
"net/http"
5+
"time"
56

67
"github.com/L4B0MB4/PRYVT/identification/pkg/aggregates"
78
models "github.com/L4B0MB4/PRYVT/identification/pkg/models/query"
@@ -41,7 +42,7 @@ func (ctrl *UserController) GetToken(c *gin.Context) {
4142
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
4243
return
4344
}
44-
token, err := auth.CreateToken(userUuid)
45+
token, err := auth.CreateToken(userUuid, 12*time.Hour)
4546
if err != nil {
4647
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
4748
return
@@ -56,7 +57,7 @@ func (ctrl *UserController) RefreshToken(c *gin.Context) {
5657
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
5758
return
5859
}
59-
token, err := auth.CreateToken(userUuid)
60+
token, err := auth.CreateToken(userUuid, 12*time.Hour)
6061

6162
if err != nil {
6263
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})

0 commit comments

Comments
 (0)