-
Notifications
You must be signed in to change notification settings - Fork 397
API key implementation #4478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
demiankatz
merged 118 commits into
vufind-org:dev
from
LuomaJuha:api-key-implementation
Oct 24, 2025
Merged
API key implementation #4478
Changes from 81 commits
Commits
Show all changes
118 commits
Select commit
Hold shift + click to select a range
feab404
Added ApiKeyService, ApiKeyTrait, Developer settings, striped-table c…
LuomaJuha fa5bb48
Added new scss alignments for creating default element alignment classes
LuomaJuha b235bf8
Adjusted api key token generation to be more unpredictable, added salt
LuomaJuha 78d900b
Added APIKeyController, user must have a verified email to create an …
LuomaJuha 65ea6b6
Adjusted translations
LuomaJuha b8da4a8
Added test for api keys to search api controller test
LuomaJuha 4b759ec
Adjusted comments
LuomaJuha 8efab0a
Revert changes to compiled css files
LuomaJuha fe4853c
Update module/VuFind/config/module.config.php
LuomaJuha f366036
Update module/VuFind/config/module.config.php
LuomaJuha f8c2f82
Update module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php
LuomaJuha 7e73ab5
Update module/VuFind/src/VuFind/ApiKey/ApiKeyTrait.php
LuomaJuha 3df7ca7
Update module/VuFind/src/VuFind/ApiKey/ApiKeyService.php
LuomaJuha 3f8d251
Update module/VuFind/src/VuFind/ApiKey/ApiKeyTrait.php
LuomaJuha 1517201
Unified API key, removed API key functionality from OAI-PMH, use conf…
LuomaJuha c39ac37
Fix errors
LuomaJuha 2ffc3cc
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha 2b717d9
Removed component adjustment
LuomaJuha 70476cf
Adjusted template breadcrumbs to be API key specific
LuomaJuha fd583c3
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 94566d6
Adjusted tests
LuomaJuha 05789f4
Removed extra newline
LuomaJuha c0495ef
Use permissions and assertion
LuomaJuha b2220f4
Adjusted assertions to be more flexible, changeg apikey controller to…
LuomaJuha 8d2be49
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 4b0332a
Update hasverifiedemailassertion to use newer lmc rbac
LuomaJuha 10a0cad
Update module/VuFind/src/VuFind/View/Helper/Root/DeveloperFactory.php
LuomaJuha 50acf3e
Update module/VuFind/src/VuFind/Role/DynamicRoleProvider.php
LuomaJuha c1aab9b
Adjusted module order, adjusted apikeyservice factory, removed getDbS…
LuomaJuha 7601d58
Merge branch 'dev' into api-key-implementation
demiankatz 0bf6250
Fix broken test.
demiankatz 4529be8
Update languages/Developer/en.ini
LuomaJuha 35aaa04
Update module/VuFind/src/VuFind/ApiKey/ApiKeyServiceFactory.php
LuomaJuha c5e1938
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha a039bda
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 80159bb
Added authorizationservicefactory, adjusted to delete only allowed to…
LuomaJuha 8d20379
Added translations for se and sv
LuomaJuha 860bb87
Update module/VuFind/src/VuFind/Db/Service/AccessTokenService.php
LuomaJuha b96795e
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 81ab265
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha ce26530
Removed developerfactory, simplify developer helper
LuomaJuha e1f2b10
Added hasverifiedemailassertion to lmc_rbac assertion_manager, added …
LuomaJuha 7e38cb7
Use parameter instead of hard coded 1
LuomaJuha 8590e2e
Renamed migrations
LuomaJuha 5fb9001
Update config/vufind/config.ini
LuomaJuha d962aed
Update module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php
LuomaJuha 70507bc
Update module/VuFindApi/src/VuFindApi/Controller/SearchApiController.php
LuomaJuha 653d92b
Update themes/bootstrap5/templates/developersettings/displaysettings.…
LuomaJuha f671a2f
Simplified api-key trait initialization, removed alignments and use b…
LuomaJuha 0422818
Fixed and cleaned up tests
LuomaJuha 27413c2
Adjusted templates, added option to create more than 1 key per user, …
LuomaJuha 923ead1
Renamed tokens to keys where applicable, change setting to key_limit
LuomaJuha 9c5777e
Adjusted names of the functions and variable to match with each other…
LuomaJuha 99b302c
Removed implements from SearchApiController, fixed migration
LuomaJuha 348a6b7
Create own table for api keys, developersettingsservice and apikeyser…
LuomaJuha 73e3f64
Adjusted pgsql
LuomaJuha 171dc81
Merge branch 'dev' into api-key-implementation
LuomaJuha 814f644
Fixed wrong comment addresses
LuomaJuha a9e0e8a
renumber migrations
LuomaJuha f0f06bc
Update year
LuomaJuha 9706d07
Use interface where plausible, removed extra lines from test
LuomaJuha f571a03
Removed unnecessary max min lengths
LuomaJuha 189feda
Cleaned api key generation template
LuomaJuha e4886c0
Implement the last used update
LuomaJuha e893d55
Minor language / punctuation tweaks.
demiankatz 50d5341
Update config/vufind/config.ini
LuomaJuha a62dc62
Update module/VuFind/src/VuFind/DeveloperSettings/DeveloperSettingsSe…
LuomaJuha 4a67a17
Update module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php
LuomaJuha f415ccd
Adjusted logics and test, readded developersettings viewhelper, added…
LuomaJuha c200917
Adjusted comments in config.ini
LuomaJuha 0dfff64
Added DeveloperSettingsServiceTest with getTestTokenIsValid and testG…
LuomaJuha b9a4dc0
Reverted input-text component, introduce it outside this pr
LuomaJuha da48185
Update config/vufind/config.ini
demiankatz ea80494
Removed extra keys, added base mink test for testing keys with records
LuomaJuha 0723215
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha 6a5b708
Mink tests working, needs cleanup
LuomaJuha ebbee27
Qa fixes
LuomaJuha fad326d
Added link to verify user email if verify_email setting is not used
LuomaJuha dd94748
Added test to verify email address to the mink, check also if the use…
LuomaJuha feb9525
Removed contents of delete expired, added check that salt is at least…
LuomaJuha 310150e
Adjusted test to use setconstructorargs
LuomaJuha 6bdae30
Adjusted api key salt_token example, removed unnecessary indexes, add…
LuomaJuha 3f5cbbe
Update module/VuFindApi/src/VuFindApi/Controller/ApiTrait.php
LuomaJuha 6dff6ca
Change to isApiKeyAllowed, clarify isApiKeyAllowed function logic and…
LuomaJuha f3480ff
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha 21a768f
Phpcbf
LuomaJuha 04ff35f
Adjust phtml indentation
LuomaJuha df4f135
Removed verify email link, if verify_auth is off then it should not b…
LuomaJuha aee0d60
Fix array indentation in template
LuomaJuha c85d988
Removed verify email key generation for now, add after
LuomaJuha dbc025d
Adjusted test order
LuomaJuha 17e8ab0
Moved request helper functions to its own trait, mock getHeader for m…
LuomaJuha 1230bfc
Adjusted comments, changed name getParamArray to getAllRequestParams …
LuomaJuha 38c7da4
Adjusted comments, sql files and tests.
LuomaJuha 0a2e9ae
Added example for createMockWithMethods
LuomaJuha fe26818
Adjusted to override
LuomaJuha a26fa33
Update module/VuFind/sql/pgsql.sql
LuomaJuha d317d7c
Update module/VuFind/sql/migrations/pgsql/11.0/010-add-api-key-table.sql
LuomaJuha b95ddee
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 5a17412
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha bfc3674
Added API key to the swagger, adjusted error message for unauthorized…
LuomaJuha 56e90e0
Update module/VuFindApi/tests/unit-tests/src/VuFindTest/Controller/Se…
LuomaJuha b2ec4cf
Added token index to orm annotation
LuomaJuha 0ee30fe
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha 02da0dd
Fixed table definition scripts and entity annotations
LuomaJuha 422a226
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha f78f376
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 19fcba2
Adjusted tests to work
LuomaJuha 4c61c48
Adjusted migration number
LuomaJuha b326a62
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 00de67f
Update module/VuFind/src/VuFind/Db/Entity/ApiKey.php
LuomaJuha ddf8262
Update module/VuFind/src/VuFind/Db/Entity/ApiKeyEntityInterface.php
LuomaJuha 8f4fca5
Update module/VuFind/sql/migrations/pgsql/11.0/012-add-api-key-table.sql
LuomaJuha f8c5810
Update module/VuFind/sql/pgsql.sql
LuomaJuha 06dbfe5
Merge branch 'api-key-implementation' of https://github.com/LuomaJuha…
LuomaJuha 50b7c8e
Merge branch 'villanova-dev' into api-key-implementation
LuomaJuha 89b29a4
Update config/vufind/config.ini
demiankatz 7b42346
Update permissions.ini
demiankatz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| api_key_deletion_success = "API key was deleted successfully." | ||
| api_key_generate = "Generate new key" | ||
| api_key_generation_success = "API key was generated successfully. Key will be displayed only once, so save it now: %%TOKEN%%" | ||
| api_key_locked = "API key is locked. Please contact support if you have questions." | ||
|
demiankatz marked this conversation as resolved.
|
||
| api_keys = "API keys" | ||
| settings = "Developer settings" | ||
| show_developer_settings = "Show developer settings" | ||
| verify_email_address = "Please verify your email address to use developer settings" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| api_key_deletion_success = "API-avaimen poistaminen onnistui" | ||
| api_key_generate = "Luo uusi avain" | ||
| api_key_generation_success = "API-avaimen luonti onnistui. Avain näytetään vain kerran, joten tallenna se muistiin: %%TOKEN%%" | ||
| api_key_locked = "API-avain on lukittu. Ota yhteyttä tukeen, jos sinulla on kysyttävää" | ||
| api_keys = "API-avaimet" | ||
| settings = "Kehittäjäasetukset" | ||
| show_developer_settings = "Näytä kehittäjäasetukset" | ||
| verify_email_address = "Vahvista sähköpostiosoitteesi käyttääksesi kehittäjäasetuksia" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| api_key_deletion_success = "API-čoavdaga sihkkun lihkostuvai" | ||
| api_key_generate = "Ráhkat ođđa čoavdaga" | ||
| api_key_generation_success = "API-čoavdaga ráhkadeapmi lihkostuvai. Čoavdda čájehuvvo dušše oktii, vurke dan muitui: %%TOKEN%%" | ||
| api_key_locked = "API-čoavdda lea lohkkaduvvon. Váldde oktavuođa doarjagii, jus dus leat jearaldagat" | ||
| api_keys = "API-čoavdda" | ||
| settings = "Ovddideaddjiásahusat" | ||
| show_developer_settings = "Čájet ovddideaddjiásahusaid" | ||
| verify_email_address = "Nanne šleađgapoastta vai beasat geavahit ovddideaddjiásahusaid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| api_key_deletion_success = "API-nyckeln har tagits bort." | ||
| api_key_generate = "Skapa en ny nyckel" | ||
| api_key_generation_success = "API-nyckeln har skapats. Nyckeln visas bara en gång så se till att spara nyckeln: %%TOKEN%%" | ||
| api_key_locked = "API-nyckeln har låsts. Kontakta supporten om du har frågor." | ||
| api_keys = "API-nycklar" | ||
| settings = "Utvecklarinställningar" | ||
| show_developer_settings = "Visa utvecklarinställningar" | ||
| verify_email_address = "Bekräfta din e-postadress för att använda utvecklarinställningar" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
module/VuFind/sql/migrations/mysql/11.0/010-add-api-key-table.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| CREATE TABLE IF NOT EXISTS `api_key` ( | ||
| `id` int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
| `user_id` int(11) DEFAULT NULL, | ||
| `title` varchar(255) NOT NULL, | ||
| `token` varchar(255) NOT NULL, | ||
| `revoked` tinyint(1) NOT NULL DEFAULT 0, | ||
| `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| `last_used` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (`id`), | ||
| KEY `api_key_user_id_idx` (`user_id`), | ||
| KEY `api_key_token_idx` (`token`), | ||
| KEY `api_key_last_used_idx` (`last_used`), | ||
| CONSTRAINT `api_key_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci; |
13 changes: 13 additions & 0 deletions
13
module/VuFind/sql/migrations/pgsql/11.0/010-add-api-key-table.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| CREATE TABLE api_key ( | ||
| id int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
| user_id int(11) DEFAULT NULL, | ||
| title varchar(255) NOT NULL, | ||
| token varchar(255) NOT NULL, | ||
| revoked tinyint(1) NOT NULL DEFAULT '0', | ||
| created timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
| last_used timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
| PRIMARY KEY (id), | ||
| ); | ||
| CREATE INDEX api_key_user_id_idx ON api_key (user_id); | ||
| CREATE INDEX api_key_token_idx ON api_key (token); | ||
| CREATE INDEX api_key_last_used_idx ON api_key (last_used); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.