File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,10 @@ func authenticator(c *gin.Context) (interface{}, error) {
34
34
return user , nil
35
35
}
36
36
37
+ // This function doesn't authenticate. Authentication to be done in middleware before invoking this function.
38
+ // This function only gets the user details.
37
39
func authenticatorForGctl (c * gin.Context ) (interface {}, error ) {
38
- auth := & types.Login {}
40
+ auth := & types.GCTLToken {}
39
41
if err := c .ShouldBind (auth ); err != nil {
40
42
return nil , errMissingCredentials
41
43
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ func NewService() http.Handler {
55
55
auth .PUT ("/revoke" , c .RevokeToken )
56
56
}
57
57
58
- auth .POST ("/gctltoken " , m .AuthRequired (), m .LoginHandler )
58
+ auth .POST ("/pat " , m .AuthRequired (), m .LoginHandler )
59
59
router .GET ("/instances" , m .AuthRequired (), c .FetchAllInstancesByUser )
60
60
router .POST ("/gctllogin" , m .JWTGctl .MiddlewareFunc (), c .GctlLogin )
61
61
Original file line number Diff line number Diff line change @@ -99,3 +99,12 @@ func (pw *PasswordUpdate) GetOldPassword() string {
99
99
func (pw * PasswordUpdate ) GetNewPassword () string {
100
100
return pw .NewPassword
101
101
}
102
+
103
+ type GCTLToken struct {
104
+ Email string `form:"email" json:"email" bson:"email" binding:"required"`
105
+ Token string `form:"token" json:"token" bson:"token" binding:"required"`
106
+ }
107
+
108
+ func (auth * GCTLToken ) GetEmail () string {
109
+ return auth .Email
110
+ }
You can’t perform that action at this time.
0 commit comments