Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-sso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
id
go-sso
Commits
a9c941a3
Commit
a9c941a3
authored
7 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Renamed Configuration to Config for uniformity
parent
bd34d614
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/sso-proxy/main.go
+2
-2
2 additions, 2 deletions
cmd/sso-proxy/main.go
proxy/proxy.go
+11
-34
11 additions, 34 deletions
proxy/proxy.go
with
13 additions
and
36 deletions
cmd/sso-proxy/main.go
+
2
−
2
View file @
a9c941a3
...
...
@@ -22,13 +22,13 @@ var (
configFile
=
flag
.
String
(
"config"
,
"/etc/sso/proxy.yml"
,
"path of config file"
)
)
func
loadConfig
()
(
*
proxy
.
Config
uration
,
error
)
{
func
loadConfig
()
(
*
proxy
.
Config
,
error
)
{
// Read YAML config.
data
,
err
:=
ioutil
.
ReadFile
(
*
configFile
)
if
err
!=
nil
{
return
nil
,
err
}
var
config
proxy
.
Config
uration
var
config
proxy
.
Config
if
err
:=
yaml
.
Unmarshal
(
data
,
&
config
);
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
proxy/proxy.go
+
11
−
34
View file @
a9c941a3
...
...
@@ -52,39 +52,10 @@ func (b *Backend) newHandler(ssow *httpsso.SSOWrapper) (http.Handler, error) {
return
h
,
nil
}
// func buildServerTLSConfig(config *Configuration) (*tls.Config, error) {
// var certs []tls.Certificate
// for _, b := range config.Backends {
// cert, err := tls.LoadX509KeyPair(b.ServerTLSConfig.Cert, b.ServerTLSConfig.Key)
// if err != nil {
// return nil, err
// }
// certs = append(certs, cert)
// }
// c := &tls.Config{
// Certificates: certs,
// }
// if config.CA != "" {
// cas, err := loadCA(config.CA)
// if err != nil {
// return nil, err
// }
// c.ClientAuth = tls.RequireAndVerifyClientCert
// c.ClientCAs = cas
// }
// c.BuildNameToCertificate()
// return c, nil
// }
// Configuration for the proxy.
type
Configuration
struct
{
// Config for the proxy.
type
Config
struct
{
SessionAuthKey
string
`yaml:"session_auth_key"`
SessionEncKey
string
`yaml:"session_enc_key"`
//CA string `yaml:"ca"`
SSOLoginServerURL
string
`yaml:"sso_server_url"`
SSOPublicKeyFile
string
`yaml:"sso_public_key_file"`
...
...
@@ -94,7 +65,7 @@ type Configuration struct {
}
// Sanity checks for the configuration.
func
(
c
*
Config
uration
)
check
()
error
{
func
(
c
*
Config
)
check
()
error
{
switch
len
(
c
.
SessionAuthKey
)
{
case
32
,
64
:
case
0
:
...
...
@@ -120,7 +91,7 @@ func (c *Configuration) check() error {
// NewProxy builds a SSO-protected multi-host handler with the
// specified configuration.
func
NewProxy
(
config
*
Config
uration
)
(
http
.
Handler
,
error
)
{
func
NewProxy
(
config
*
Config
)
(
http
.
Handler
,
error
)
{
if
err
:=
config
.
check
();
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -130,7 +101,13 @@ func NewProxy(config *Configuration) (http.Handler, error) {
return
nil
,
err
}
w
,
err
:=
httpsso
.
NewSSOWrapper
(
config
.
SSOLoginServerURL
,
pkey
,
config
.
SSODomain
,
[]
byte
(
config
.
SessionAuthKey
),
[]
byte
(
config
.
SessionEncKey
))
w
,
err
:=
httpsso
.
NewSSOWrapper
(
config
.
SSOLoginServerURL
,
pkey
,
config
.
SSODomain
,
[]
byte
(
config
.
SessionAuthKey
),
[]
byte
(
config
.
SessionEncKey
),
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment