fix(oauth): state to follow OAuth 2 RFC against CSRF
parent
b537a9ad0d
commit
a33dbd1e91
|
@ -119,18 +119,12 @@ function($async, $q, $scope, $state, $stateParams, $sanitize, Authentication, Us
|
|||
}
|
||||
|
||||
function generateState() {
|
||||
if ($scope.state.OAuthProvider !== 'OAuth') {
|
||||
return '';
|
||||
}
|
||||
const uuid = uuidv4();
|
||||
LocalStorage.storeLoginStateUUID(uuid);
|
||||
return '&state=' + uuid;
|
||||
}
|
||||
|
||||
function hasValidState(state) {
|
||||
if ($scope.state.OAuthProvider !== 'OAuth') {
|
||||
return true;
|
||||
}
|
||||
const savedUUID = LocalStorage.getLoginStateUUID();
|
||||
return savedUUID === state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue