mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 07:30:55 +00:00
Merge pull request #4116 from livelyRyan/patch-2
添加 BConfig.Listen.ClientAuth 字段及处理逻辑
This commit is contained in:
commit
87b40ee9e7
2
app.go
2
app.go
@ -197,7 +197,7 @@ func (app *App) Run(mws ...MiddleWare) {
|
|||||||
pool.AppendCertsFromPEM(data)
|
pool.AppendCertsFromPEM(data)
|
||||||
app.Server.TLSConfig = &tls.Config{
|
app.Server.TLSConfig = &tls.Config{
|
||||||
ClientCAs: pool,
|
ClientCAs: pool,
|
||||||
ClientAuth: tls.RequireAndVerifyClientCert,
|
ClientAuth: BConfig.Listen.ClientAuth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := app.Server.ListenAndServeTLS(BConfig.Listen.HTTPSCertFile, BConfig.Listen.HTTPSKeyFile); err != nil {
|
if err := app.Server.ListenAndServeTLS(BConfig.Listen.HTTPSCertFile, BConfig.Listen.HTTPSKeyFile); err != nil {
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"crypto/tls"
|
||||||
|
|
||||||
"github.com/astaxie/beego/config"
|
"github.com/astaxie/beego/config"
|
||||||
"github.com/astaxie/beego/context"
|
"github.com/astaxie/beego/context"
|
||||||
@ -65,6 +66,7 @@ type Listen struct {
|
|||||||
HTTPSCertFile string
|
HTTPSCertFile string
|
||||||
HTTPSKeyFile string
|
HTTPSKeyFile string
|
||||||
TrustCaFile string
|
TrustCaFile string
|
||||||
|
ClientAuth tls.ClientAuthType
|
||||||
EnableAdmin bool
|
EnableAdmin bool
|
||||||
AdminAddr string
|
AdminAddr string
|
||||||
AdminPort int
|
AdminPort int
|
||||||
@ -234,6 +236,7 @@ func newBConfig() *Config {
|
|||||||
AdminPort: 8088,
|
AdminPort: 8088,
|
||||||
EnableFcgi: false,
|
EnableFcgi: false,
|
||||||
EnableStdIo: false,
|
EnableStdIo: false,
|
||||||
|
ClientAuth: tls.RequireAndVerifyClientCert,
|
||||||
},
|
},
|
||||||
WebConfig: WebConfig{
|
WebConfig: WebConfig{
|
||||||
AutoRender: true,
|
AutoRender: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user