'commit'
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
8186976d90
commit
89b5d90841
@ -0,0 +1,31 @@
|
||||
package SSOAccountController
|
||||
|
||||
import (
|
||||
"dsSupport/MyModel/SSOAccount/SSOAccountOpenAPI"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Routers(r *gin.RouterGroup) {
|
||||
rr := r.Group("/ssoAccount")
|
||||
|
||||
{
|
||||
rr.POST("/login", SSOAccountOpenAPI.Login)
|
||||
rr.OPTIONS("/login", HandleOptions)
|
||||
rr.POST("/logout", SSOAccountOpenAPI.Logout)
|
||||
rr.GET("/logout", SSOAccountOpenAPI.Logout)
|
||||
rr.OPTIONS("/logout", HandleOptions)
|
||||
rr.POST("/userInfo", SSOAccountOpenAPI.UserInfo)
|
||||
rr.GET("/userInfo", SSOAccountOpenAPI.UserInfo)
|
||||
rr.OPTIONS("/userInfo", HandleOptions)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func HandleOptions(c *gin.Context) {
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
|
||||
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
|
||||
|
||||
c.String(200, "ok")
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package SSOAccountService
|
||||
|
||||
import (
|
||||
"github.com/shenshouer/cas"
|
||||
)
|
||||
|
||||
var casURL = "http://10.10.14.199:8080/dsssoserver/" //单点登录地址
|
||||
|
||||
type templateBinding struct {
|
||||
Username string
|
||||
Attributes cas.UserAttributes
|
||||
}
|
||||
|
||||
func Login() (bool, string) {
|
||||
|
||||
return true, ""
|
||||
}
|
||||
|
||||
func UserInfo() (bool, string) {
|
||||
//u, _ := url.Parse(casURL)
|
||||
//c := cas.NewClient(&cas.Options{
|
||||
// URL: u,
|
||||
//})
|
||||
//
|
||||
//h := c.HandleFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// if !cas.IsAuthenticated(r) {
|
||||
// cas.RedirectToLogout(w, r)
|
||||
// }
|
||||
//
|
||||
// fmt.Fprintf(w, "Hello %s\n", cas.Username(r))
|
||||
//})
|
||||
//
|
||||
//err := http.ListenAndServe(":8080", h)
|
||||
//if err != nil {
|
||||
// log.Fatal("ListenAndServe: ", err)
|
||||
//}
|
||||
|
||||
return true, ""
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue