feat: 客户端oauth2认证模块
This commit is contained in:
33
src/modules/oam/oauth2_api.go
Normal file
33
src/modules/oam/oauth2_api.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package oam
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"be.ems/src/framework/middleware"
|
||||
monitorController "be.ems/src/modules/monitor/controller"
|
||||
neController "be.ems/src/modules/network_element/controller"
|
||||
)
|
||||
|
||||
// SetupOauth2 客户端授权开放接口
|
||||
func SetupOauth2(router *gin.Engine) {
|
||||
openApiGroup := router.Group("/open-api")
|
||||
|
||||
// 监控
|
||||
monitorGroup := openApiGroup.Group("/monitor")
|
||||
{
|
||||
monitorGroup.GET("/system",
|
||||
middleware.AuthorizeOauth2(nil),
|
||||
monitorController.NewSystem.Info,
|
||||
)
|
||||
}
|
||||
|
||||
// 网元
|
||||
neGroup := openApiGroup.Group("/ne")
|
||||
{
|
||||
neGroup.GET("/state",
|
||||
middleware.AuthorizeOauth2(nil),
|
||||
neController.NewNeInfo.State,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user