Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
19ae65c5
Commit
19ae65c5
authored
12 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
if fetch of .well-known fails, then fall back to proxy_idps from the config file
parent
66c28d8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/primary.js
+18
-6
18 additions, 6 deletions
lib/primary.js
with
18 additions
and
6 deletions
lib/primary.js
+
18
−
6
View file @
19ae65c5
...
@@ -104,8 +104,6 @@ function parseWellKnownBody(body, domain, delegates, cb) {
...
@@ -104,8 +104,6 @@ function parseWellKnownBody(body, domain, delegates, cb) {
});
});
}
}
// Support "shimmed primaries" for local development. That is an environment variable that is any number of
// Support "shimmed primaries" for local development. That is an environment variable that is any number of
// CSV values of the form:
// CSV values of the form:
// <domain>|<origin>|<path to .well-known/browserid>,
// <domain>|<origin>|<path to .well-known/browserid>,
...
@@ -131,14 +129,29 @@ if (process.env['SHIMMED_PRIMARIES']) {
...
@@ -131,14 +129,29 @@ if (process.env['SHIMMED_PRIMARIES']) {
}
}
var
getWellKnown
=
function
(
domain
,
delegates
,
cb
)
{
var
getWellKnown
=
function
(
domain
,
delegates
,
cb
)
{
// called when we fail to fetch well-known. Looks in configuration for proxyidp
// configuration, if that exists, it's as if a delegation of authority existed.
function
handleProxyIDP
()
{
var
proxyIDPs
=
config
.
get
(
'
proxy_idps
'
);
if
(
proxyIDPs
.
hasOwnProperty
(
domain
))
{
var
generatedBody
=
JSON
.
stringify
({
authority
:
proxyIDPs
[
domain
]
});
cb
(
null
,
generatedBody
,
domain
,
delegates
);
}
else
{
cb
(
null
,
false
,
null
);
}
}
function
handleResponse
(
res
)
{
function
handleResponse
(
res
)
{
if
(
res
.
statusCode
!==
200
)
{
if
(
res
.
statusCode
!==
200
)
{
logger
.
debug
(
domain
+
'
is not a browserid primary - non-200 response code to
'
+
WELL_KNOWN_URL
);
logger
.
debug
(
domain
+
'
is not a browserid primary - non-200 response code to
'
+
WELL_KNOWN_URL
);
return
cb
(
null
,
false
,
null
);
return
handleProxyIDP
(
);
}
}
if
(
res
.
headers
[
'
content-type
'
].
indexOf
(
'
application/json
'
)
!==
0
)
{
if
(
res
.
headers
[
'
content-type
'
].
indexOf
(
'
application/json
'
)
!==
0
)
{
logger
.
debug
(
domain
+
'
is not a browserid primary - non "application/json" response to
'
+
WELL_KNOWN_URL
);
logger
.
debug
(
domain
+
'
is not a browserid primary - non "application/json" response to
'
+
WELL_KNOWN_URL
);
return
cb
(
null
,
false
,
null
);
return
handleProxyIDP
(
);
}
}
var
body
=
""
;
var
body
=
""
;
...
@@ -178,7 +191,7 @@ var getWellKnown = function (domain, delegates, cb) {
...
@@ -178,7 +191,7 @@ var getWellKnown = function (domain, delegates, cb) {
req
.
on
(
'
error
'
,
function
(
e
)
{
req
.
on
(
'
error
'
,
function
(
e
)
{
logger
.
debug
(
domain
+
'
is not a browserid primary:
'
+
e
.
toString
());
logger
.
debug
(
domain
+
'
is not a browserid primary:
'
+
e
.
toString
());
cb
(
null
,
false
,
null
);
handleProxyIDP
(
);
});
});
};
};
...
@@ -198,7 +211,6 @@ exports.checkSupport = function(domain, cb, delegates) {
...
@@ -198,7 +211,6 @@ exports.checkSupport = function(domain, cb, delegates) {
return
process
.
nextTick
(
function
()
{
cb
(
"
invalid domain
"
);
});
return
process
.
nextTick
(
function
()
{
cb
(
"
invalid domain
"
);
});
}
}
getWellKnown
(
domain
,
delegates
,
function
(
err
,
body
,
domain
,
cbdelegates
)
{
getWellKnown
(
domain
,
delegates
,
function
(
err
,
body
,
domain
,
cbdelegates
)
{
if
(
err
)
{
if
(
err
)
{
logger
.
debug
(
err
);
logger
.
debug
(
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