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
69364ec2
Commit
69364ec2
authored
Apr 12, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #403 from ericchiang/db_errors
db: print better error messages for invalid input
parents
ed89be44
5c5df23a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
client.go
db/client.go
+5
-1
user.go
db/user.go
+6
-0
No files found.
db/client.go
View file @
69364ec2
...
@@ -100,9 +100,13 @@ func NewClientIdentityRepoFromClients(dbm *gorp.DbMap, clients []oidc.ClientIden
...
@@ -100,9 +100,13 @@ func NewClientIdentityRepoFromClients(dbm *gorp.DbMap, clients []oidc.ClientIden
defer
tx
.
Rollback
()
defer
tx
.
Rollback
()
exec
:=
repo
.
executor
(
tx
)
exec
:=
repo
.
executor
(
tx
)
for
_
,
c
:=
range
clients
{
for
_
,
c
:=
range
clients
{
if
c
.
Credentials
.
Secret
==
""
{
return
nil
,
fmt
.
Errorf
(
"client %q has no secret"
,
c
.
Credentials
.
ID
)
}
dec
,
err
:=
base64
.
URLEncoding
.
DecodeString
(
c
.
Credentials
.
Secret
)
dec
,
err
:=
base64
.
URLEncoding
.
DecodeString
(
c
.
Credentials
.
Secret
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"client secrets must be base64 decodable. See issue #337. Please consider replacing %q with %q"
,
c
.
Credentials
.
Secret
,
base64
.
URLEncoding
.
EncodeToString
([]
byte
(
c
.
Credentials
.
Secret
)))
}
}
cm
,
err
:=
newClientIdentityModel
(
c
.
Credentials
.
ID
,
dec
,
&
c
.
Metadata
)
cm
,
err
:=
newClientIdentityModel
(
c
.
Credentials
.
ID
,
dec
,
&
c
.
Metadata
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
db/user.go
View file @
69364ec2
...
@@ -451,6 +451,12 @@ func (u *userModel) user() (user.User, error) {
...
@@ -451,6 +451,12 @@ func (u *userModel) user() (user.User, error) {
}
}
func
newUserModel
(
u
*
user
.
User
)
(
*
userModel
,
error
)
{
func
newUserModel
(
u
*
user
.
User
)
(
*
userModel
,
error
)
{
if
u
.
ID
==
""
{
return
nil
,
fmt
.
Errorf
(
"user is missing ID field"
)
}
if
u
.
Email
==
""
{
return
nil
,
fmt
.
Errorf
(
"user %s is missing email field"
,
u
.
ID
)
}
um
:=
userModel
{
um
:=
userModel
{
ID
:
u
.
ID
,
ID
:
u
.
ID
,
DisplayName
:
u
.
DisplayName
,
DisplayName
:
u
.
DisplayName
,
...
...
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