Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
dcf58351
Commit
dcf58351
authored
Feb 09, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: remove in memory connector config repo
parent
b572b8dd
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
37 deletions
+52
-37
api_test.go
admin/api_test.go
+9
-3
config_repo.go
connector/config_repo.go
+0
-23
connector_repo_test.go
functional/repo/connector_repo_test.go
+6
-2
common_test.go
integration/common_test.go
+9
-3
config.go
server/config.go
+4
-1
testutil.go
server/testutil.go
+4
-1
api_test.go
user/api/api_test.go
+10
-2
manager_test.go
user/manager/manager_test.go
+10
-2
No files found.
admin/api_test.go
View file @
dcf58351
...
...
@@ -59,9 +59,15 @@ func makeTestFixtures() *testFixtures {
return
repo
}()
ccr
:=
connector
.
NewConnectorConfigRepoFromConfigs
([]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
},
})
ccr
:=
func
()
connector
.
ConnectorConfigRepo
{
c
:=
[]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
}}
repo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
if
err
:=
repo
.
Set
(
c
);
err
!=
nil
{
panic
(
err
)
}
return
repo
}()
f
.
mgr
=
manager
.
NewUserManager
(
f
.
ur
,
f
.
pwr
,
ccr
,
db
.
TransactionFactory
(
dbMap
),
manager
.
ManagerOptions
{})
f
.
adAPI
=
NewAdminAPI
(
f
.
mgr
,
f
.
ur
,
f
.
pwr
,
"local"
)
...
...
connector/config_repo.go
View file @
dcf58351
...
...
@@ -3,8 +3,6 @@ package connector
import
(
"encoding/json"
"io"
"github.com/coreos/dex/repo"
)
func
ReadConfigs
(
r
io
.
Reader
)
([]
ConnectorConfig
,
error
)
{
...
...
@@ -22,24 +20,3 @@ func ReadConfigs(r io.Reader) ([]ConnectorConfig, error) {
}
return
cfgs
,
nil
}
type
memConnectorConfigRepo
struct
{
configs
[]
ConnectorConfig
}
func
NewConnectorConfigRepoFromConfigs
(
cfgs
[]
ConnectorConfig
)
ConnectorConfigRepo
{
return
&
memConnectorConfigRepo
{
configs
:
cfgs
}
}
func
(
r
*
memConnectorConfigRepo
)
All
()
([]
ConnectorConfig
,
error
)
{
return
r
.
configs
,
nil
}
func
(
r
*
memConnectorConfigRepo
)
GetConnectorByID
(
_
repo
.
Transaction
,
id
string
)
(
ConnectorConfig
,
error
)
{
for
_
,
cfg
:=
range
r
.
configs
{
if
cfg
.
ConnectorID
()
==
id
{
return
cfg
,
nil
}
}
return
nil
,
ErrorNotFound
}
functional/repo/connector_repo_test.go
View file @
dcf58351
...
...
@@ -4,15 +4,19 @@ import (
"os"
"testing"
"github.com/go-gorp/gorp"
"github.com/coreos/dex/connector"
"github.com/coreos/dex/db"
)
func
newConnectorConfigRepo
(
t
*
testing
.
T
,
configs
[]
connector
.
ConnectorConfig
)
connector
.
ConnectorConfigRepo
{
var
dbMap
*
gorp
.
DbMap
if
os
.
Getenv
(
"DEX_TEST_DSN"
)
==
""
{
return
connector
.
NewConnectorConfigRepoFromConfigs
(
configs
)
dbMap
=
db
.
NewMemDB
()
}
else
{
dbMap
=
connect
(
t
)
}
dbMap
:=
connect
(
t
)
repo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
if
err
:=
repo
.
Set
(
configs
);
err
!=
nil
{
t
.
Fatalf
(
"Unable to set connector configs: %v"
,
err
)
...
...
integration/common_test.go
View file @
dcf58351
...
...
@@ -62,9 +62,15 @@ func makeUserObjects(users []user.UserWithRemoteIdentities, passwords []user.Pas
return
repo
}()
ccr
:=
connector
.
NewConnectorConfigRepoFromConfigs
(
[]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
}},
)
ccr
:=
func
()
connector
.
ConnectorConfigRepo
{
repo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
c
:=
[]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
}}
if
err
:=
repo
.
Set
(
c
);
err
!=
nil
{
panic
(
err
)
}
return
repo
}()
um
:=
manager
.
NewUserManager
(
ur
,
pwr
,
ccr
,
db
.
TransactionFactory
(
dbMap
),
manager
.
ManagerOptions
{})
um
.
Clock
=
clock
return
ur
,
pwr
,
um
...
...
server/config.go
View file @
dcf58351
...
...
@@ -131,7 +131,10 @@ func (cfg *SingleServerConfig) Configure(srv *Server) error {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"decoding connector configs: %v"
,
err
)
}
cfgRepo
:=
connector
.
NewConnectorConfigRepoFromConfigs
(
cfgs
)
cfgRepo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
if
err
:=
cfgRepo
.
Set
(
cfgs
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to set connectors: %v"
,
err
)
}
sRepo
:=
db
.
NewSessionRepo
(
dbMap
)
skRepo
:=
db
.
NewSessionKeyRepo
(
dbMap
)
...
...
server/testutil.go
View file @
dcf58351
...
...
@@ -118,7 +118,10 @@ func makeTestFixtures() (*testFixtures, error) {
ID
:
"local"
,
},
}
connCfgRepo
:=
connector
.
NewConnectorConfigRepoFromConfigs
(
connConfigs
)
connCfgRepo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
if
err
:=
connCfgRepo
.
Set
(
connConfigs
);
err
!=
nil
{
return
nil
,
err
}
manager
:=
usermanager
.
NewUserManager
(
userRepo
,
pwRepo
,
connCfgRepo
,
db
.
TransactionFactory
(
dbMap
),
usermanager
.
ManagerOptions
{})
...
...
user/api/api_test.go
View file @
dcf58351
...
...
@@ -141,9 +141,17 @@ func makeTestFixtures() (*UsersAPI, *testEmailer) {
return
repo
}()
ccr
:=
connector
.
NewConnectorConfigRepoFromConfigs
([]
connector
.
ConnectorConfig
{
ccr
:=
func
()
connector
.
ConnectorConfigRepo
{
repo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
c
:=
[]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
},
})
}
if
err
:=
repo
.
Set
(
c
);
err
!=
nil
{
panic
(
err
)
}
return
repo
}()
mgr
:=
manager
.
NewUserManager
(
ur
,
pwr
,
ccr
,
db
.
TransactionFactory
(
dbMap
),
manager
.
ManagerOptions
{})
mgr
.
Clock
=
clock
ci
:=
oidc
.
ClientIdentity
{
...
...
user/manager/manager_test.go
View file @
dcf58351
...
...
@@ -77,9 +77,17 @@ func makeTestFixtures() *testFixtures {
return
repo
}()
f
.
ccr
=
connector
.
NewConnectorConfigRepoFromConfigs
([]
connector
.
ConnectorConfig
{
f
.
ccr
=
func
()
connector
.
ConnectorConfigRepo
{
repo
:=
db
.
NewConnectorConfigRepo
(
dbMap
)
c
:=
[]
connector
.
ConnectorConfig
{
&
connector
.
LocalConnectorConfig
{
ID
:
"local"
},
})
}
if
err
:=
repo
.
Set
(
c
);
err
!=
nil
{
panic
(
err
)
}
return
repo
}()
f
.
mgr
=
NewUserManager
(
f
.
ur
,
f
.
pwr
,
f
.
ccr
,
db
.
TransactionFactory
(
dbMap
),
ManagerOptions
{})
f
.
mgr
.
Clock
=
f
.
clock
return
f
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment