Files
open-im-server/internal/api/auth.go
T

28 lines
719 B
Go
Raw Normal View History

2023-02-28 14:20:26 +08:00
package api
2021-12-27 18:22:32 +08:00
import (
2023-03-17 11:27:34 +08:00
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
2023-03-16 10:46:06 +08:00
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
2023-05-16 12:17:43 +08:00
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/auth"
2023-06-20 22:12:01 +08:00
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
2022-08-07 22:37:27 +08:00
"github.com/gin-gonic/gin"
2021-12-27 18:22:32 +08:00
)
2023-06-20 22:12:01 +08:00
type AuthApi rpcclient.Auth
2021-12-27 18:22:32 +08:00
2023-06-20 22:12:01 +08:00
func NewAuthApi(discov discoveryregistry.SvcDiscoveryRegistry) AuthApi {
return AuthApi(*rpcclient.NewAuth(discov))
2022-05-10 09:45:55 +08:00
}
2022-06-06 20:39:45 +08:00
2023-06-20 22:12:01 +08:00
func (o *AuthApi) UserToken(c *gin.Context) {
2023-06-20 20:50:15 +08:00
a2r.Call(auth.AuthClient.UserToken, o.Client, c)
2023-02-28 11:38:05 +08:00
}
2022-06-07 11:42:15 +08:00
2023-06-20 22:12:01 +08:00
func (o *AuthApi) ParseToken(c *gin.Context) {
2023-06-20 20:50:15 +08:00
a2r.Call(auth.AuthClient.ParseToken, o.Client, c)
2023-02-28 11:38:05 +08:00
}
2022-06-06 20:39:45 +08:00
2023-06-20 22:12:01 +08:00
func (o *AuthApi) ForceLogout(c *gin.Context) {
2023-06-20 20:50:15 +08:00
a2r.Call(auth.AuthClient.ForceLogout, o.Client, c)
2022-06-06 20:39:45 +08:00
}