Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
49e6b52a
Commit
49e6b52a
authored
Aug 28, 2017
by
Jeffrey Phillips
Committed by
GitHub
Aug 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #151 from david-martin/allow-oauth-scope-config
Allow OAuth scope(s) to be configured
parents
d07857a2
0a82ae7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
3 deletions
+50
-3
origin-web-common-services.js
dist/origin-web-common-services.js
+15
-0
origin-web-common.js
dist/origin-web-common.js
+15
-0
origin-web-common.min.js
dist/origin-web-common.min.js
+5
-3
redirectLoginService.js
src/services/redirectLoginService.js
+15
-0
No files found.
dist/origin-web-common-services.js
View file @
49e6b52a
...
...
@@ -3171,6 +3171,7 @@ angular.module('openshiftCommonServices')
var
_oauth_authorize_uri
=
""
;
var
_oauth_token_uri
=
""
;
var
_oauth_redirect_uri
=
""
;
var
_oauth_scope
=
""
;
this
.
OAuthClientID
=
function
(
id
)
{
if
(
id
)
{
...
...
@@ -3196,6 +3197,12 @@ angular.module('openshiftCommonServices')
}
return
_oauth_redirect_uri
;
};
this
.
OAuthScope
=
function
(
scope
)
{
if
(
scope
)
{
_oauth_scope
=
scope
;
}
return
_oauth_scope
;
}
this
.
$get
=
function
(
$injector
,
$location
,
$q
,
Logger
,
base64
)
{
var
authLogger
=
Logger
.
get
(
"auth"
);
...
...
@@ -3286,6 +3293,10 @@ angular.module('openshiftCommonServices')
redirect_uri
:
_oauth_redirect_uri
};
if
(
_oauth_scope
)
{
authorizeParams
.
scope
=
_oauth_scope
;
}
if
(
_oauth_token_uri
)
{
authorizeParams
.
response_type
=
"code"
;
// TODO: add PKCE
...
...
@@ -3377,6 +3388,10 @@ angular.module('openshiftCommonServices')
"client_id="
+
encodeURIComponent
(
_oauth_client_id
)
].
join
(
"&"
);
if
(
_oauth_scope
)
{
tokenPostData
+=
"&scope="
+
encodeURIComponent
(
_oauth_scope
);
}
return
http
({
method
:
"POST"
,
url
:
_oauth_token_uri
,
...
...
dist/origin-web-common.js
View file @
49e6b52a
...
...
@@ -5039,6 +5039,7 @@ angular.module('openshiftCommonServices')
var
_oauth_authorize_uri
=
""
;
var
_oauth_token_uri
=
""
;
var
_oauth_redirect_uri
=
""
;
var
_oauth_scope
=
""
;
this
.
OAuthClientID
=
function
(
id
)
{
if
(
id
)
{
...
...
@@ -5064,6 +5065,12 @@ angular.module('openshiftCommonServices')
}
return
_oauth_redirect_uri
;
};
this
.
OAuthScope
=
function
(
scope
)
{
if
(
scope
)
{
_oauth_scope
=
scope
;
}
return
_oauth_scope
;
}
this
.
$get
=
[
"$injector"
,
"$location"
,
"$q"
,
"Logger"
,
"base64"
,
function
(
$injector
,
$location
,
$q
,
Logger
,
base64
)
{
var
authLogger
=
Logger
.
get
(
"auth"
);
...
...
@@ -5154,6 +5161,10 @@ angular.module('openshiftCommonServices')
redirect_uri
:
_oauth_redirect_uri
};
if
(
_oauth_scope
)
{
authorizeParams
.
scope
=
_oauth_scope
;
}
if
(
_oauth_token_uri
)
{
authorizeParams
.
response_type
=
"code"
;
// TODO: add PKCE
...
...
@@ -5245,6 +5256,10 @@ angular.module('openshiftCommonServices')
"client_id="
+
encodeURIComponent
(
_oauth_client_id
)
].
join
(
"&"
);
if
(
_oauth_scope
)
{
tokenPostData
+=
"&scope="
+
encodeURIComponent
(
_oauth_scope
);
}
return
http
({
method
:
"POST"
,
url
:
_oauth_token_uri
,
...
...
dist/origin-web-common.min.js
View file @
49e6b52a
...
...
@@ -2095,7 +2095,7 @@ orderByMostRecentlyViewed:orderByMostRecentlyViewed,
clear
:
clear
};
}
]),
angular
.
module
(
"openshiftCommonServices"
).
provider
(
"RedirectLoginService"
,
function
()
{
var
_oauth_client_id
=
""
,
_oauth_authorize_uri
=
""
,
_oauth_token_uri
=
""
,
_oauth_redirect_uri
=
""
;
var
_oauth_client_id
=
""
,
_oauth_authorize_uri
=
""
,
_oauth_token_uri
=
""
,
_oauth_redirect_uri
=
""
,
_oauth_scope
=
""
;
this
.
OAuthClientID
=
function
(
id
)
{
return
id
&&
(
_oauth_client_id
=
id
),
_oauth_client_id
;
},
this
.
OAuthAuthorizeURI
=
function
(
uri
)
{
...
...
@@ -2104,6 +2104,8 @@ return uri && (_oauth_authorize_uri = uri), _oauth_authorize_uri;
return
uri
&&
(
_oauth_token_uri
=
uri
),
_oauth_token_uri
;
},
this
.
OAuthRedirectURI
=
function
(
uri
)
{
return
uri
&&
(
_oauth_redirect_uri
=
uri
),
_oauth_redirect_uri
;
},
this
.
OAuthScope
=
function
(
scope
)
{
return
scope
&&
(
_oauth_scope
=
scope
),
_oauth_scope
;
},
this
.
$get
=
[
"$injector"
,
"$location"
,
"$q"
,
"Logger"
,
"base64"
,
function
(
$injector
,
$location
,
$q
,
Logger
,
base64
)
{
var
authLogger
=
Logger
.
get
(
"auth"
),
getRandomInts
=
function
(
length
)
{
var
randomValues
;
...
...
@@ -2168,7 +2170,7 @@ response_type:"token",
state
:
makeState
(
returnUri
.
toString
()),
redirect_uri
:
_oauth_redirect_uri
};
_oauth_token_uri
&&
(
authorizeParams
.
response_type
=
"code"
);
_oauth_
scope
&&
(
authorizeParams
.
scope
=
_oauth_scope
),
_oauth_
token_uri
&&
(
authorizeParams
.
response_type
=
"code"
);
var
deferred
=
$q
.
defer
(),
uri
=
new
URI
(
_oauth_authorize_uri
);
return
uri
.
query
(
authorizeParams
),
authLogger
.
log
(
"RedirectLoginService.login(), redirecting"
,
uri
.
toString
()),
window
.
location
.
href
=
uri
.
toString
(),
deferred
.
promise
;
},
...
...
@@ -2198,7 +2200,7 @@ error:"invalid_request",
error_description
:
"Client state could not be verified"
});
var
tokenPostData
=
[
"grant_type=authorization_code"
,
"code="
+
encodeURIComponent
(
queryParams
.
code
),
"redirect_uri="
+
encodeURIComponent
(
_oauth_redirect_uri
),
"client_id="
+
encodeURIComponent
(
_oauth_client_id
)
].
join
(
"&"
);
return
http
({
return
_oauth_scope
&&
(
tokenPostData
+=
"&scope="
+
encodeURIComponent
(
_oauth_scope
)),
http
({
method
:
"POST"
,
url
:
_oauth_token_uri
,
headers
:{
...
...
src/services/redirectLoginService.js
View file @
49e6b52a
...
...
@@ -7,6 +7,7 @@ angular.module('openshiftCommonServices')
var
_oauth_authorize_uri
=
""
;
var
_oauth_token_uri
=
""
;
var
_oauth_redirect_uri
=
""
;
var
_oauth_scope
=
""
;
this
.
OAuthClientID
=
function
(
id
)
{
if
(
id
)
{
...
...
@@ -32,6 +33,12 @@ angular.module('openshiftCommonServices')
}
return
_oauth_redirect_uri
;
};
this
.
OAuthScope
=
function
(
scope
)
{
if
(
scope
)
{
_oauth_scope
=
scope
;
}
return
_oauth_scope
;
}
this
.
$get
=
function
(
$injector
,
$location
,
$q
,
Logger
,
base64
)
{
var
authLogger
=
Logger
.
get
(
"auth"
);
...
...
@@ -122,6 +129,10 @@ angular.module('openshiftCommonServices')
redirect_uri
:
_oauth_redirect_uri
};
if
(
_oauth_scope
)
{
authorizeParams
.
scope
=
_oauth_scope
;
}
if
(
_oauth_token_uri
)
{
authorizeParams
.
response_type
=
"code"
;
// TODO: add PKCE
...
...
@@ -213,6 +224,10 @@ angular.module('openshiftCommonServices')
"client_id="
+
encodeURIComponent
(
_oauth_client_id
)
].
join
(
"&"
);
if
(
_oauth_scope
)
{
tokenPostData
+=
"&scope="
+
encodeURIComponent
(
_oauth_scope
);
}
return
http
({
method
:
"POST"
,
url
:
_oauth_token_uri
,
...
...
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