-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: agent tokens by default are not tied to any user
- Loading branch information
Showing
8 changed files
with
108 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -4,9 +4,11 @@ | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd"> | ||
|
||
<property name="concordAgentUserId" value="d4f123c1-f8d4-40b2-8a12-b8947b9ce2d8"/> | ||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- <property name="concordAgentUserId" value="d4f123c1-f8d4-40b2-8a12-b8947b9ce2d8"/>--> | ||
|
||
<!-- moved to v1.86.0.xml (no more hard-coded default token) --> | ||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- <changeSet id="69000" author="[email protected]"> | ||
<insert tableName="USERS"> | ||
<column name="USER_ID">${concordAgentUserId}</column> | ||
|
@@ -21,7 +23,9 @@ | |
</insert> | ||
</changeSet> --> | ||
|
||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- Create agent user when not exist --> | ||
<!-- | ||
<changeSet id="69001" author="[email protected]"> | ||
<preConditions onFail="MARK_RAN"> | ||
<sqlCheck expectedResult="0"> | ||
|
@@ -37,5 +41,5 @@ | |
<column name="USER_TYPE">LOCAL</column> | ||
</insert> | ||
</changeSet> | ||
|
||
--> | ||
</databaseChangeLog> |
This file contains 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 |
---|---|---|
|
@@ -4,12 +4,15 @@ | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd"> | ||
|
||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- | ||
<changeSet id="79000" author="[email protected]"> | ||
<insert tableName="USER_ROLES"> | ||
<column name="ROLE_ID">${concordSystemReaderRoleId}</column> | ||
<column name="USER_ID">${concordAgentUserId}</column> | ||
</insert> | ||
</changeSet> | ||
--> | ||
|
||
<changeSet id="79100" author="[email protected]"> | ||
<addColumn tableName="API_KEYS"> | ||
|
This file contains 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 |
---|---|---|
|
@@ -7,16 +7,20 @@ | |
<property name="concordSystemWriterRoleId" value="c162d868-89ea-11e8-80be-97fd8a9f7419"/> | ||
|
||
<changeSet id="80000" author="[email protected]"> | ||
<validCheckSum>ANY</validCheckSum> | ||
<insert tableName="ROLES"> | ||
<column name="ROLE_ID">${concordSystemWriterRoleId}</column> | ||
<column name="ROLE_NAME">concordSystemWriter</column> | ||
<column name="GLOBAL_WRITER">true</column> | ||
</insert> | ||
|
||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- | ||
<insert tableName="USER_ROLES"> | ||
<column name="ROLE_ID">${concordSystemWriterRoleId}</column> | ||
<column name="USER_ID">${concordAgentUserId}</column> | ||
</insert> | ||
--> | ||
</changeSet> | ||
|
||
<!-- removed in 1.9.0+ | ||
|
This file contains 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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd"> | ||
|
||
<property name="concordAdminUserId" value="230c5c9c-d9a7-11e6-bcfd-bb681c07b26c"/> | ||
<property name="concordAgentUserId" value="d4f123c1-f8d4-40b2-8a12-b8947b9ce2d8"/> | ||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- <property name="concordAgentUserId" value="d4f123c1-f8d4-40b2-8a12-b8947b9ce2d8"/>--> | ||
<property name="concordRunnerUserId" value="2599c604-1384-4660-a767-8bc03baa7a31"/> | ||
|
||
<!-- delete old hard-coded default admin API token --> | ||
|
@@ -38,15 +39,20 @@ | |
</changeSet> | ||
|
||
<!-- delete old hard-coded default agent API token --> | ||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- | ||
<changeSet id="1860200" author="[email protected]" runInTransaction="false" context="!codegen"> | ||
<sql> | ||
delete from API_KEYS | ||
where USER_ID = '${concordAgentUserId}' | ||
and API_KEY = '1sw9eLZ41EOK4w/iV3jFnn6cqeAMeFtxfazqVY04koY' | ||
</sql> | ||
</changeSet> | ||
--> | ||
|
||
<!-- Set initial agent API token when not exist --> | ||
<!-- concord agent user disabled from 2.21.x --> | ||
<!-- | ||
<changeSet id="1860300" author="[email protected]" runInTransaction="false" context="!codegen"> | ||
<validCheckSum>ANY</validCheckSum> | ||
|
@@ -60,14 +66,13 @@ | |
</preConditions> | ||
<customChange class="com.walmartlabs.concord.server.liquibase.ext.ApiTokenCreator"> | ||
<!-- default agent user id from v0.69.0.xml --> | ||
<param name="userId" value="${concordAgentUserId}"/> | ||
<param name="username" value="concordAgent"/> | ||
<!-- values from concord-server.conf --> | ||
<param name="token" value="${defaultAgentToken}"/> | ||
<param name="skip" value="${skipAgentTokenGeneration}"/> | ||
</customChange> | ||
</changeSet> | ||
--> | ||
|
||
<!-- Delete runner API tokens and user when exist --> | ||
<changeSet id="1860400" author="[email protected]" runInTransaction="false" context="!codegen"> | ||
|
48 changes: 48 additions & 0 deletions
48
server/db/src/main/resources/com/walmartlabs/concord/server/db/v2.21.0.xml
This file contains 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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd"> | ||
|
||
<changeSet id="2210000" author="[email protected]"> | ||
<dropNotNullConstraint tableName="API_KEYS" columnName="USER_ID"/> | ||
</changeSet> | ||
|
||
<changeSet id="2210010" author="[email protected]"> | ||
<dropIndex tableName="API_KEYS " indexName="IDX_API_KEYS_NAME_USER"/> | ||
|
||
<sql> | ||
create unique index IDX_API_KEYS_NAME_USER_NULL on API_KEYS (KEY_NAME) where USER_ID is null | ||
</sql> | ||
<sql> | ||
create unique index IDX_API_KEYS_NAME_USER_NOT_NULL on API_KEYS (KEY_NAME, USER_ID) where USER_ID is not null | ||
</sql> | ||
</changeSet> | ||
|
||
<changeSet id="2210020" author="[email protected]" runInTransaction="false" context="!codegen"> | ||
<validCheckSum>ANY</validCheckSum> | ||
|
||
<preConditions onFail="MARK_RAN"> | ||
<sqlCheck expectedResult="0"> | ||
select count(key_id) | ||
from API_KEYS | ||
where KEY_NAME = 'concordAgentKey_autogenerated'; | ||
</sqlCheck> | ||
<!-- concordAgentUserId='d4f123c1-f8d4-40b2-8a12-b8947b9ce2d8' --> | ||
<sqlCheck expectedResult="0"> | ||
select count(key_id) | ||
from API_KEYS | ||
where USER_ID = 'd4f123c1-f8d4-40b2-8a12-b8947b9ce2d8'; | ||
</sqlCheck> | ||
</preConditions> | ||
|
||
<customChange class="com.walmartlabs.concord.server.liquibase.ext.ApiTokenCreator"> | ||
<!-- default agent user id from v0.69.0.xml --> | ||
<param name="keyName" value="concordAgentKey_autogenerated"/> | ||
<!-- values from concord-server.conf --> | ||
<param name="token" value="${defaultAgentToken}"/> | ||
<param name="skip" value="${skipAgentTokenGeneration}"/> | ||
</customChange> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
This file contains 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 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