* Get the corresponding database table based on model name
()
| 44 | * Get the corresponding database table based on model name |
| 45 | */ |
| 46 | private getTable() { |
| 47 | log('Getting table for model: %s', this.name); |
| 48 | switch (this.name) { |
| 49 | case 'AccessToken': { |
| 50 | return oidcAccessTokens; |
| 51 | } |
| 52 | case 'AuthorizationCode': { |
| 53 | return oidcAuthorizationCodes; |
| 54 | } |
| 55 | case 'RefreshToken': { |
| 56 | return oidcRefreshTokens; |
| 57 | } |
| 58 | case 'DeviceCode': { |
| 59 | return oidcDeviceCodes; |
| 60 | } |
| 61 | case 'ClientCredentials': { |
| 62 | return oidcAccessTokens; |
| 63 | } // Use the same table |
| 64 | case 'Client': { |
| 65 | return oidcClients; |
| 66 | } |
| 67 | case 'InitialAccessToken': { |
| 68 | return oidcAccessTokens; |
| 69 | } // Use the same table |
| 70 | case 'RegistrationAccessToken': { |
| 71 | return oidcAccessTokens; |
| 72 | } // Use the same table |
| 73 | case 'Interaction': { |
| 74 | return oidcInteractions; |
| 75 | } |
| 76 | case 'ReplayDetection': { |
| 77 | log('ReplayDetection - no persistent storage needed'); |
| 78 | return null; |
| 79 | } // No persistent storage needed |
| 80 | case 'PushedAuthorizationRequest': { |
| 81 | return oidcAuthorizationCodes; |
| 82 | } // Use the same table |
| 83 | case 'Grant': { |
| 84 | return oidcGrants; |
| 85 | } |
| 86 | case 'Session': { |
| 87 | return oidcSessions; |
| 88 | } |
| 89 | default: { |
| 90 | const error = `Unsupported model: ${this.name}`; |
| 91 | log('ERROR: %s', error); |
| 92 | throw new Error(error); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Create or update model instance |
no test coverage detected