Skip to content
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

Add externalized user directory to secrets connector #8421

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EgeriaContentPacksGUIDMap.json

Large diffs are not rendered by default.

74 changes: 8 additions & 66 deletions application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ platform.configstore.endpoint=data/servers/{0}/config/{0}.config
### Set up the platform metadata security connector that provides authorization
### for platform administration, server operations and diagnostic calls.
### By default, there is no platform metadata security connector.
### The values below are for a sample platform metadata security connector where the only userId
### that is permitted to use the administration and platform services is `garygeeke`.
### The values below are for a sample platform metadata security connector based off of Coco Pharmaceutical persona
###############################################
platform.security.provider=org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaPlatformSecurityProvider
platform.security.provider=org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaSecretsSecurityProvider
platform.security.name=Coco Pharmaceuticals Platform
platform.security.secrets.provider=org.odpi.openmetadata.adapters.connectors.secretsstore.yaml.YAMLSecretsStoreProvider
platform.security.secrets.location=loading-bay/secrets/demo-user-directory.omsecrets
platform.security.secrets.collection=userDirectory

###############################################
### Set up the default configuration document for any new OMAG Server configurations.
Expand Down Expand Up @@ -96,34 +98,11 @@ strict.ssl=false
# User security
################################################

# Authentication source (possible values: demo, ldap, ad)
authentication.source=demo
# Authentication mode (possible values: session,token,redis)
# Authentication source
authentication.source=platform
# Authentication mode
authentication.mode=token

#token timeout in minutes
token.timeout=15
token.absolute.timeout=720
token.secret=doNotTell

#LDAP authentication

ldap.domain=
ldap.user.search.base=ou=people,dc=egeria,dc=com
ldap.user.search.filter=uid={0}
ldap.group.search.base=ou=Groups,dc=egeria,dc=com
ldap.group.search.filter=member={0}
ldap.url=ldap://localhost:389
ldap.group.role.attribute=
ldap.npa.dn=
ldap.npa.password=
#ldap.user.dn.patterns patterns is a list of values separated by ";" as comma is used in the ldap pattern
ldap.user.dn.patterns=

# Redis configuration
#redis.host=localhost
#redis.port=6379

################################################
### Additional demo users configuration for when authentication.source=demo
### This file is located in the resources folder of the user-authn module and built into its runtime jar
Expand Down Expand Up @@ -152,43 +131,6 @@ cors.allowed-origins=*
app.description=Have a question? || Get in touch via our Slack community https://slack.lfai.foundation/ @@What is Open Metadata? || Find out more on our website https://egeria-project.org/ @@Have more cool ideas? || Feel free to let us know your ideas so we can make it better.
app.title=Egeria Open Metadata | Find the right data with governance

# ##############################################################
# Component visibility for Role based access ###################
# ##############################################################
# How it works?
#
# The roles are defined in external authentication source (provider) configured with `authentication.source`.
# For demo purposes, we are providing simple file based authentication provider. See demo-users.yml
# The matrix controlling what components are allowed on the UI views for specific role is defined in the 'role.visibleComponents' prefixed properties as follows"
#
# role.visibleComponents.{ROLE-1}={component-name-1}
# role.visibleComponents.{ROLE-2}={component-name-1},{component-name-2}
#
# This will configure the application to show the component named 'component-name-1' for all uses assigned to 'ROLE-1'
# In the same way, users that have assigned 'ROLE-2' can see more 'component-name-1' and 'component-name-2'.
# It is also possible to use wildcard '*' to enable full visibility of all components to users in the given role.
#
# Complete list of components names that can be used:
#
# about
# asset-catalog
# asset-details
# asset-details-print
# glossary
# repository-explorer
# type-explorer
# asset-lineage
# asset-lineage-print
# end-to-end
# ultimate-source
# ultimate-destination
# vertical-lineage
#
# Below is the default configuration for the two COCO_PHARMA roles we use for demo:

role.visibleComponents.COCO_PHARMA_USER=about,asset-catalog,asset-details,asset-details-print,asset-lineage,asset-lineage-print,end-to-end,ultimate-source,ultimate-destination,vertical-lineage,glossary,repository-explorer
role.visibleComponents.COCO_PHARMA_ADMIN=*

################################################
### Which java packages should be scanned to locate the Spring resource definitions that define the REST APIs?
################################################
Expand Down
74 changes: 8 additions & 66 deletions container.application.properties
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ platform.configstore.endpoint=data/servers/{0}/config/{0}.config
### Set up the platform metadata security connector that provides authorization
### for platform administration, server operations and diagnostic calls.
### By default, there is no platform metadata security connector.
### The values below are for a sample platform metadata security connector where the only userId
### that is permitted to use the administration and platform services is `garygeeke`.
### The values below are for a sample platform metadata security connector based off of Coco Pharmaceutical persona
###############################################
platform.security.provider=org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaPlatformSecurityProvider
platform.security.provider=org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaSecretsSecurityProvider
platform.security.name=Coco Pharmaceuticals Platform
platform.security.secrets.provider=org.odpi.openmetadata.adapters.connectors.secretsstore.yaml.YAMLSecretsStoreProvider
platform.security.secrets.location=loading-bay/secrets/demo-user-directory.omsecrets
platform.security.secrets.collection=userDirectory

###############################################
### Set up the default configuration document for any new OMAG Server configurations.
Expand Down Expand Up @@ -96,34 +98,11 @@ strict.ssl=false
# User security
################################################

# Authentication source (possible values: demo, ldap, ad)
authentication.source=demo
# Authentication mode (possible values: session,token,redis)
# Authentication source
authentication.source=platform
# Authentication mode
authentication.mode=token

#token timeout in minutes
token.timeout=15
token.absolute.timeout=720
token.secret=doNotTell

#LDAP authentication

ldap.domain=
ldap.user.search.base=ou=people,dc=egeria,dc=com
ldap.user.search.filter=uid={0}
ldap.group.search.base=ou=Groups,dc=egeria,dc=com
ldap.group.search.filter=member={0}
ldap.url=ldap://localhost:389
ldap.group.role.attribute=
ldap.npa.dn=
ldap.npa.password=
#ldap.user.dn.patterns patterns is a list of values separated by ";" as comma is used in the ldap pattern
ldap.user.dn.patterns=

# Redis configuration
#redis.host=localhost
#redis.port=6379

################################################
### Additional demo users configuration for when authentication.source=demo
### This file is located in the resources folder of the user-authn module and built into its runtime jar
Expand Down Expand Up @@ -152,43 +131,6 @@ cors.allowed-origins=*
app.description=Have a question? || Get in touch via our Slack community https://slack.lfai.foundation/ @@What is Open Metadata? || Find out more on our website https://egeria-project.org/ @@Have more cool ideas? || Feel free to let us know your ideas so we can make it better.
app.title=Egeria Open Metadata | Find the right data with governance

# ##############################################################
# Component visibility for Role based access ###################
# ##############################################################
# How it works?
#
# The roles are defined in external authentication source (provider) configured with `authentication.source`.
# For demo purposes, we are providing simple file based authentication provider. See demo-users.yml
# The matrix controlling what components are allowed on the UI views for specific role is defined in the 'role.visibleComponents' prefixed properties as follows"
#
# role.visibleComponents.{ROLE-1}={component-name-1}
# role.visibleComponents.{ROLE-2}={component-name-1},{component-name-2}
#
# This will configure the application to show the component named 'component-name-1' for all uses assigned to 'ROLE-1'
# In the same way, users that have assigned 'ROLE-2' can see more 'component-name-1' and 'component-name-2'.
# It is also possible to use wildcard '*' to enable full visibility of all components to users in the given role.
#
# Complete list of components names that can be used:
#
# about
# asset-catalog
# asset-details
# asset-details-print
# glossary
# repository-explorer
# type-explorer
# asset-lineage
# asset-lineage-print
# end-to-end
# ultimate-source
# ultimate-destination
# vertical-lineage
#
# Below is the default configuration for the two COCO_PHARMA roles we use for demo:

role.visibleComponents.COCO_PHARMA_USER=about,asset-catalog,asset-details,asset-details-print,asset-lineage,asset-lineage-print,end-to-end,ultimate-source,ultimate-destination,vertical-lineage,glossary,repository-explorer
role.visibleComponents.COCO_PHARMA_ADMIN=*

################################################
### Which java packages should be scanned to locate the Spring resource definitions that define the REST APIs?
################################################
Expand Down
2 changes: 1 addition & 1 deletion content-packs/APIsContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ApacheAtlasContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ApacheKafkaContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoBusinessSystemsArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoClinicalTrialsTemplatesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoComboArchive.omarchive

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoGovernanceProgramArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoOrganizationArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoSustainabilityArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoTypesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CoreContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ObservabilityContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/OpenMetadataTypes.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/PostgresContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/UnityCatalogContentPack.omarchive

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.odpi.openmetadata.frameworks.connectors.controls.SecretsStorePurpose;
import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException;
import org.odpi.openmetadata.frameworks.connectors.properties.EndpointProperties;
import org.odpi.openmetadata.frameworks.connectors.properties.users.UserAccount;
import org.odpi.openmetadata.tokenmanager.http.HTTPHeadersThreadLocal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -159,6 +160,19 @@ else if (SecretsStorePurpose.REST_BASIC_AUTHENTICATION.getName().equals(secretsS
break;
}
}
else if (SecretsStorePurpose.USER_DIRECTORY.getName().equals(secretsStorePurpose))
{
if (userId != null)
{
UserAccount userAccount = secretsStoreConnector.getUser(userId);

if ((userAccount != null) && (userAccount.getSecrets() != null) && (userAccount.getSecrets().get(SecretsStoreCollectionProperty.CLEAR_PASSWORD.getName()) != null))
{
authorizationHeader = this.createAuthorizationHeaders(userId, userAccount.getSecrets().get(SecretsStoreCollectionProperty.CLEAR_PASSWORD.getName()));
break;
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import org.odpi.openmetadata.frameworks.connectors.SecretsStoreConnector;
import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException;
import org.odpi.openmetadata.frameworks.connectors.properties.users.UserAccount;

import java.util.Map;

/**
* EnvVarSecretsStoreConnector retrieves secrets from environment variables. Each secret is named for its environment variable.
Expand Down Expand Up @@ -33,6 +36,51 @@
}


/**
* Retrieve a secret from the secrets store.
*
* @param secretsCollectionName name of collection
* @param secretName name of the secret.
* @return secret
*/
@Override
public String getSecret(String secretsCollectionName,
String secretName)

{
return System.getenv(this.secretsCollectionName + "_" + secretName);
}


/**
* Retrieve any user definitions stored in the secrets collection.
*
* @return map of userIds to user details
*/
public Map<String, UserAccount> getUsers()

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
SecretsStoreConnector.getUsers
; it is advisable to add an Override annotation.
{
/*
* Not supported.
*/
return null;
}


/**
* Retrieve the requested user definitions stored in the secrets collection.
*
* @param userId userId for the lookup
* @return associated user details or null
*/
public UserAccount getUser(String userId)

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
SecretsStoreConnector.getUser
; it is advisable to add an Override annotation.
{
/*
* Not supported.
*/
return null;
}


/**
* Retrieve the refresh time from the secrets store.
*
Expand Down
Loading
Loading