Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
7b4723c8
Commit
7b4723c8
authored
Sep 06, 2016
by
Robert Knight
Committed by
GitHub
Sep 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #89 from hypothesis/remove-assertion-param
Remove "assertion" GET param from token requests
parents
326b4518
e0e23bde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
6 deletions
+2
-6
auth.js
h/static/scripts/auth.js
+2
-5
auth-test.js
h/static/scripts/test/auth-test.js
+0
-1
No files found.
h/static/scripts/auth.js
View file @
7b4723c8
...
@@ -24,12 +24,9 @@ var cachedToken = INITIAL_TOKEN;
...
@@ -24,12 +24,9 @@ var cachedToken = INITIAL_TOKEN;
* @return {Promise} - A promise for a new JWT token.
* @return {Promise} - A promise for a new JWT token.
*/
*/
// @ngInject
// @ngInject
function
fetchToken
(
$http
,
se
ssion
,
se
ttings
)
{
function
fetchToken
(
$http
,
settings
)
{
var
tokenUrl
=
new
URL
(
'token'
,
settings
.
apiUrl
).
href
;
var
tokenUrl
=
new
URL
(
'token'
,
settings
.
apiUrl
).
href
;
var
config
=
{
var
config
=
{
params
:
{
assertion
:
session
.
state
.
csrf
,
},
// Skip JWT authorization for the token request itself.
// Skip JWT authorization for the token request itself.
skipAuthorization
:
true
,
skipAuthorization
:
true
,
transformRequest
:
function
(
data
)
{
transformRequest
:
function
(
data
)
{
...
@@ -50,7 +47,7 @@ function fetchToken($http, session, settings) {
...
@@ -50,7 +47,7 @@ function fetchToken($http, session, settings) {
// @ngInject
// @ngInject
function
fetchOrReuseToken
(
$http
,
jwtHelper
,
session
,
settings
)
{
function
fetchOrReuseToken
(
$http
,
jwtHelper
,
session
,
settings
)
{
function
refreshToken
()
{
function
refreshToken
()
{
return
fetchToken
(
$http
,
se
ssion
,
se
ttings
).
then
(
function
(
token
)
{
return
fetchToken
(
$http
,
settings
).
then
(
function
(
token
)
{
return
token
;
return
token
;
});
});
}
}
...
...
h/static/scripts/test/auth-test.js
View file @
7b4723c8
...
@@ -16,7 +16,6 @@ describe('auth', function () {
...
@@ -16,7 +16,6 @@ describe('auth', function () {
get
:
sinon
.
spy
(
function
(
url
,
config
)
{
get
:
sinon
.
spy
(
function
(
url
,
config
)
{
assert
.
equal
(
config
.
skipAuthorization
,
true
);
assert
.
equal
(
config
.
skipAuthorization
,
true
);
assert
.
equal
(
url
,
'https://test.hypothes.is/api/token'
);
assert
.
equal
(
url
,
'https://test.hypothes.is/api/token'
);
assert
.
equal
(
config
.
params
.
assertion
,
fakeSession
.
state
.
csrf
);
var
result
=
{
status
:
200
,
data
:
fakeTokens
[
fakeTokenIndex
]};
var
result
=
{
status
:
200
,
data
:
fakeTokens
[
fakeTokenIndex
]};
++
fakeTokenIndex
;
++
fakeTokenIndex
;
...
...
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