mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Add localhost:8585 as jwks urls; Fix entity consolidations when there is no previous chnage available (#15001)
This commit is contained in:
		
							parent
							
								
									25c6260bd7
								
							
						
					
					
						commit
						968f146fe7
					
				| @ -2057,6 +2057,7 @@ public abstract class EntityRepository<T extends EntityInterface> { | |||||||
|       // set changeDescription to null |       // set changeDescription to null | ||||||
|       T updatedOld = updated; |       T updatedOld = updated; | ||||||
|       previous = getPreviousVersion(original); |       previous = getPreviousVersion(original); | ||||||
|  |       if (previous != null) { | ||||||
|         LOG.debug( |         LOG.debug( | ||||||
|             "In session change consolidation. Reverting to previous version {}", |             "In session change consolidation. Reverting to previous version {}", | ||||||
|             previous.getVersion()); |             previous.getVersion()); | ||||||
| @ -2074,6 +2075,7 @@ public abstract class EntityRepository<T extends EntityInterface> { | |||||||
|         original = previous; |         original = previous; | ||||||
|         entityChanged = false; |         entityChanged = false; | ||||||
|       } |       } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     /** Compare original and updated entities and perform updates. Update the entity version and track changes. */ |     /** Compare original and updated entities and perform updates. Update the entity version and track changes. */ | ||||||
|     @Transaction |     @Transaction | ||||||
|  | |||||||
| @ -59,6 +59,11 @@ public class JwtFilter implements ContainerRequestFilter { | |||||||
|   private String principalDomain; |   private String principalDomain; | ||||||
|   private boolean enforcePrincipalDomain; |   private boolean enforcePrincipalDomain; | ||||||
|   private AuthProvider providerType; |   private AuthProvider providerType; | ||||||
|  | 
 | ||||||
|  |   private static final List<String> DEFAULT_PUBLIC_KEY_URLS = | ||||||
|  |       Arrays.asList( | ||||||
|  |           "http://localhost:8585/api/v1/system/config/jwks", | ||||||
|  |           "http://host.docker.internal:8585/api/v1/system/config/jwks"); | ||||||
|   public static final List<String> EXCLUDED_ENDPOINTS = |   public static final List<String> EXCLUDED_ENDPOINTS = | ||||||
|       List.of( |       List.of( | ||||||
|           "v1/system/config/jwks", |           "v1/system/config/jwks", | ||||||
| @ -89,6 +94,13 @@ public class JwtFilter implements ContainerRequestFilter { | |||||||
|     for (String publicKeyUrlStr : authenticationConfiguration.getPublicKeyUrls()) { |     for (String publicKeyUrlStr : authenticationConfiguration.getPublicKeyUrls()) { | ||||||
|       publicKeyUrlsBuilder.add(new URL(publicKeyUrlStr)); |       publicKeyUrlsBuilder.add(new URL(publicKeyUrlStr)); | ||||||
|     } |     } | ||||||
|  |     // avoid users misconfiguration and add default publicKeyUrls | ||||||
|  |     for (String publicKeyUrl : DEFAULT_PUBLIC_KEY_URLS) { | ||||||
|  |       if (!authenticationConfiguration.getPublicKeyUrls().contains(publicKeyUrl)) { | ||||||
|  |         publicKeyUrlsBuilder.add(new URL(publicKeyUrl)); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     this.jwkProvider = new MultiUrlJwkProvider(publicKeyUrlsBuilder.build()); |     this.jwkProvider = new MultiUrlJwkProvider(publicKeyUrlsBuilder.build()); | ||||||
|     this.principalDomain = authorizerConfiguration.getPrincipalDomain(); |     this.principalDomain = authorizerConfiguration.getPrincipalDomain(); | ||||||
|     this.enforcePrincipalDomain = authorizerConfiguration.getEnforcePrincipalDomain(); |     this.enforcePrincipalDomain = authorizerConfiguration.getEnforcePrincipalDomain(); | ||||||
|  | |||||||
| @ -32,7 +32,9 @@ final class MultiUrlJwkProvider implements JwkProvider { | |||||||
|   public Jwk get(String keyId) throws JwkException { |   public Jwk get(String keyId) throws JwkException { | ||||||
|     JwkException lastException = |     JwkException lastException = | ||||||
|         new SigningKeyNotFoundException( |         new SigningKeyNotFoundException( | ||||||
|             "JWT Token keyID doesn't match the configured keyID.", null); |             "JWT Token keyID doesn't match the configured keyID. This usually happens if you didn't configure " | ||||||
|  |                 + "proper publicKeyUrls under authentication configuration.", | ||||||
|  |             null); | ||||||
|     for (UrlJwkProvider jwkProvider : urlJwkProviders) { |     for (UrlJwkProvider jwkProvider : urlJwkProviders) { | ||||||
|       try { |       try { | ||||||
|         return jwkProvider.get(keyId); |         return jwkProvider.get(keyId); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sriharsha Chintalapani
						Sriharsha Chintalapani