mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
fix cas bug
Change-Id: I19e64b3fabe47b74c0c5653c31815742ad69003e
This commit is contained in:
parent
61e8c06634
commit
bdc46d5869
@ -111,11 +111,12 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
":": []string{"command"},
|
||||
"::": []string{"command", "list"},
|
||||
|
||||
"pwd": []string{"nfs.pwd"},
|
||||
"path": []string{"nfs.path"},
|
||||
"dir": []string{"nfs.dir"},
|
||||
"git": []string{"nfs.git"},
|
||||
"brow": []string{"web.brow"},
|
||||
"pwd": []string{"nfs.pwd"},
|
||||
"path": []string{"nfs.path"},
|
||||
"dir": []string{"nfs.dir"},
|
||||
"git": []string{"nfs.git"},
|
||||
"brow": []string{"web.brow"},
|
||||
"ifconfig": []string{"tcp.ifconfig"},
|
||||
}, Help: "启动脚本"},
|
||||
|
||||
"time_unit": &ctx.Config{Name: "time_unit", Value: "1000", Help: "时间倍数"},
|
||||
|
@ -779,7 +779,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
||||
}
|
||||
list = append(list, args...)
|
||||
|
||||
msg := cmd.Sess("cli").Cmd("source", strings.Join(list, " "))
|
||||
msg := cmd.Sess("cli").Set("option", "current_ctx", m.target.Name).Cmd("source", strings.Join(list, " "))
|
||||
cmd.Copy(msg, "append").Copy(msg, "result").Copy(msg, "target")
|
||||
return
|
||||
}}
|
||||
|
@ -90,8 +90,8 @@ func (c *Context) Begin(m *Message, arg ...string) *Context {
|
||||
}
|
||||
|
||||
module := c.Name
|
||||
if c.context != nil {
|
||||
module = c.context.Name + "." + c.Name
|
||||
if c.context != nil && c.context.Caches != nil && c.context.Caches["module"] != nil {
|
||||
module = c.context.Caches["module"].Value + "." + c.Name
|
||||
}
|
||||
|
||||
c.Caches["module"] = &Cache{Name: "module", Value: module, Help: "模块域名"}
|
||||
@ -1492,6 +1492,14 @@ func (m *Message) Confm(key string, args ...interface{}) map[string]interface{}
|
||||
fun(k, val)
|
||||
}
|
||||
}
|
||||
case func(string, map[string]interface{}) bool:
|
||||
for k, v := range value {
|
||||
if val, ok := v.(map[string]interface{}); ok {
|
||||
if fun(k, val) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
case func(int, map[string]interface{}):
|
||||
for i, v := range table {
|
||||
if val, ok := v.(map[string]interface{}); ok {
|
||||
|
@ -111,23 +111,18 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
},
|
||||
})
|
||||
|
||||
m.Log("fuck", "what %v", node.Meta)
|
||||
// 主机路由
|
||||
m.Conf("runtime", "node.route", node.Append("node.route")+"."+node.Result(0))
|
||||
if !m.Confs("runtime", "user.route") {
|
||||
if m.Confs("runtime", "user.cert") && m.Confs("runtime", "user.key") {
|
||||
m.Cmd("ssh.share", "root", m.Conf("runtime", "node.route"))
|
||||
m.Log("fuck", "what %v", 123)
|
||||
m.Log("fuck", "what %v", node.Meta)
|
||||
if !node.Appends("user.route") {
|
||||
m.Log("fuck", "what %v", 123)
|
||||
m.Cmd("ssh.share", node.Append("node.route"), "root", m.Conf("runtime", "node.route"))
|
||||
}
|
||||
|
||||
} else if node.Appends("user.route") {
|
||||
m.Cmd("ssh.share", "root", node.Append("user.route"))
|
||||
}
|
||||
}
|
||||
if !node.Appends("user.route") {
|
||||
m.Cmd("ssh.share", node.Append("node.route"), "root", m.Conf("runtime", "node.route"))
|
||||
}
|
||||
|
||||
// 默认节点
|
||||
if !m.Confs("current") {
|
||||
@ -426,7 +421,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
m.Cmd("aaa.auth", "proxy")
|
||||
return
|
||||
}
|
||||
m.Cmd("aaa.auth", "proxy", arg[0])
|
||||
if !m.Cmds("aaa.auth", "proxy", arg[0], "session") {
|
||||
m.Cmd("aaa.sess", "proxy", "proxy", arg[0])
|
||||
}
|
||||
return
|
||||
}},
|
||||
"login": &ctx.Command{Name: "login client.route", Help: "用户节点", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||
@ -489,6 +486,15 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
} else if m.Confm("node", arg[0]) != nil {
|
||||
m.Conf("current", arg[0])
|
||||
arg = arg[1:]
|
||||
} else {
|
||||
m.Confm("node", func(name string, node map[string]interface{}) bool {
|
||||
if strings.Contains(name, arg[0]) {
|
||||
m.Conf("current", name)
|
||||
arg = arg[1:]
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
|
||||
msg := m.Cmd("ssh.remote", m.Conf("current"), arg)
|
||||
|
@ -95,6 +95,7 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
|
||||
if msg.Confs("login", "cas_url") && !msg.Confs("login", "skip_cas") {
|
||||
if !cas.IsAuthenticated(r) {
|
||||
r.URL, _ = r.URL.Parse(r.Header.Get("index_url"))
|
||||
msg.Log("info", "cas_login %v %v", r.URL, msg.Conf("login", "cas_url"))
|
||||
cas.RedirectToLogin(w, r)
|
||||
return false
|
||||
}
|
||||
@ -105,6 +106,7 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
}
|
||||
|
||||
msg.Log("info", "cas_login %v", msg.Option("ticket"))
|
||||
if msg.Options("ticket") {
|
||||
msg.Option("uuid", msg.Option(msg.Conf("login", "cas_uuid")))
|
||||
msg.Option("username", cas.Username(r))
|
||||
@ -319,6 +321,7 @@ func (web *WEB) Start(m *ctx.Message, arg ...string) bool {
|
||||
})
|
||||
|
||||
// SSO认证
|
||||
m.Log("info", "web: %s", m.Conf("login", "cas_url"))
|
||||
var handler http.Handler
|
||||
if cas_url, e := url.Parse(m.Conf("login", "cas_url")); e == nil && m.Confs("login", "cas_url") {
|
||||
m.Log("info", "cas url: %s", m.Conf("login", "cas_url"))
|
||||
@ -328,6 +331,7 @@ func (web *WEB) Start(m *ctx.Message, arg ...string) bool {
|
||||
handler = web
|
||||
}
|
||||
|
||||
m.Log("info", "web: %s", m.Cap("address"))
|
||||
// 启动服务
|
||||
web.Server = &http.Server{Addr: m.Cap("address"), Handler: handler}
|
||||
if m.Caps("master", true); m.Cap("protocol") == "https" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user