@@ -2,7 +2,6 @@ import jsonwebtoken from 'jsonwebtoken';
2
2
3
3
import { config } from '../../../../src/shared/config.js' ;
4
4
import {
5
- ForbiddenAccess ,
6
5
InvalidExternalUserTokenError ,
7
6
InvalidResultRecipientTokenError ,
8
7
InvalidSessionResultTokenError ,
@@ -51,17 +50,6 @@ function createAccessTokenFromApplication(
51
50
) ;
52
51
}
53
52
54
- function createTokenForCampaignResults ( { userId, campaignId } ) {
55
- return jsonwebtoken . sign (
56
- {
57
- access_id : userId ,
58
- campaign_id : campaignId ,
59
- } ,
60
- config . authentication . secret ,
61
- { expiresIn : config . authentication . tokenForCampaignResultLifespan } ,
62
- ) ;
63
- }
64
-
65
53
function createIdTokenForUserReconciliation ( externalUser ) {
66
54
return jsonwebtoken . sign (
67
55
{
@@ -187,14 +175,6 @@ function extractClientId(token, secret = config.authentication.secret) {
187
175
return decoded . client_id || null ;
188
176
}
189
177
190
- function extractCampaignResultsTokenContent ( token ) {
191
- const decoded = getDecodedToken ( token ) ;
192
- if ( decoded === false ) {
193
- throw new ForbiddenAccess ( ) ;
194
- }
195
- return { userId : decoded . access_id , campaignId : decoded . campaign_id } ;
196
- }
197
-
198
178
async function extractExternalUserFromIdToken ( token ) {
199
179
const externalUser = await getDecodedToken ( token ) ;
200
180
@@ -215,7 +195,6 @@ const tokenService = {
215
195
createAccessTokenForSaml,
216
196
createAccessTokenFromApplication,
217
197
createAccessTokenFromAnonymousUser,
218
- createTokenForCampaignResults,
219
198
createIdTokenForUserReconciliation,
220
199
createCertificationResultsByRecipientEmailLinkToken,
221
200
createCertificationResultsLinkToken,
@@ -229,7 +208,6 @@ const tokenService = {
229
208
extractTokenFromAuthChain,
230
209
extractUserId,
231
210
extractClientId,
232
- extractCampaignResultsTokenContent,
233
211
} ;
234
212
235
213
/**
@@ -245,9 +223,7 @@ export {
245
223
createCertificationResultsLinkToken ,
246
224
createIdTokenForUserReconciliation ,
247
225
createPasswordResetToken ,
248
- createTokenForCampaignResults ,
249
226
decodeIfValid ,
250
- extractCampaignResultsTokenContent ,
251
227
extractCertificationResultsByRecipientEmailLink ,
252
228
extractCertificationResultsLink ,
253
229
extractClientId ,
0 commit comments