2021-11-24 12:41:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								title: "datahub-frontend"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								# DataHub Frontend Proxy
  
						 
					
						
							
								
									
										
										
										
											2019-12-18 18:57:18 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								DataHub frontend is a [Play ](https://www.playframework.com/ ) service written in Java. It is served as a mid-tier
							 
						 
					
						
							
								
									
										
										
										
											2021-08-20 10:58:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								between [DataHub GMS ](../metadata-service ) which is the backend service and [DataHub Web ](../datahub-web-react/README.md ).
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Pre-requisites
  
						 
					
						
							
								
									
										
										
										
											2021-07-22 15:58:30 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  You need to have [JDK8 ](https://www.oracle.com/java/technologies/jdk8-downloads.html ) 
						 
					
						
							
								
									
										
										
										
											2019-12-18 18:57:18 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								installed on your machine to be able to build `DataHub Frontend` .
							 
						 
					
						
							
								
									
										
										
										
											2021-07-22 15:58:30 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								*  You need to have [Chrome ](https://www.google.com/chrome/ ) web browser 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								installed to be able to build because UI tests have a dependency on `Google Chrome` .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Build
  
						 
					
						
							
								
									
										
										
										
											2019-12-18 18:57:18 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								`DataHub Frontend`  is already built as part of top level build: 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								./gradlew build
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-12-18 18:57:18 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								However, if you only want to build `DataHub Frontend`  specifically:
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2022-05-18 18:13:45 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								./gradlew :datahub-frontend:dist
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Dependencies
  
						 
					
						
							
								
									
										
										
										
											2021-08-20 10:58:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Before starting `DataHub Frontend` , you need to make sure that [DataHub GMS ](../metadata-service ) and
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								all its dependencies have already started and running.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Start via Docker image
  
						 
					
						
							
								
									
										
										
										
											2021-03-07 10:46:27 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								Quickest way to try out `DataHub Frontend`  is running the [Docker image ](../docker/datahub-frontend ).
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								## Start via command line
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								If you do modify things and want to try it out quickly without building the Docker image, you can also run
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								the application directly from command line after a successful [build ](#build ):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								cd datahub-frontend/run & &  ./run-local-frontend
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-18 18:57:18 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Checking out DataHub UI
  
						 
					
						
							
								
									
										
										
										
											2021-07-22 15:58:30 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								After starting your application in one of the two ways mentioned above, you can connect to it by typing below
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								into your favorite web browser:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2022-03-01 16:55:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								http://localhost:9002
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2021-10-26 12:18:36 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								To be able to sign in, you need to provide your user name. The default account is `datahub` , password `datahub` .
							 
						 
					
						
							
								
									
										
										
										
											2019-09-08 20:25:58 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 11:02:45 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								## Authentication
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								DataHub frontend leverages [Java Authentication and Authorization Service (JAAS) ](https://docs.oracle.com/javase/7/docs/technotes/guides/security/jaas/JAASRefGuide.html ) to perform the authentication. By default we provided a [DummyLoginModule ](app/security/DummyLoginModule.java ) which will accept any username/password combination. You can update [jaas.conf ](conf/jaas.conf ) to match your authentication requirement. For example, use the following config for LDAP-based authentication,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								WHZ-Authentication {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								     
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    < host > :636/dc=< domain > " 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								     
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								    & (objectClass=person)(uid={USERNAME}))" 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								     
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								     
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								     
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								};
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-11 13:38:35 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								### Authentication in React
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The React app supports both JAAS as described above and separately OIDC authentication. To learn about configuring OIDC for React,
							 
						 
					
						
							
								
									
										
										
										
											2022-07-01 20:35:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								see the [OIDC in React ](../docs/authentication/guides/sso/configure-oidc-react.md ) document.
							 
						 
					
						
							
								
									
										
										
										
											2021-03-11 13:38:35 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-12 10:42:45 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								### API Debugging
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Most DataHub frontend API endpoints are protected using [Play Authentication ](https://www.playframework.com/documentation/2.1.0/JavaGuide4 ), which means it requires authentication information stored in the cookie for the request to go through. This makes debugging using curl difficult. One option is to first make a curl call against the `/authenticate`  endpoint and stores the authentication info in a cookie file like this
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2022-03-01 16:55:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								curl -c cookie.txt -d '{"username":"datahub", "password":"datahub"}' -H 'Content-Type: application/json' http://localhost:9002/authenticate
							 
						 
					
						
							
								
									
										
										
										
											2020-10-12 10:42:45 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								You can then make all subsequent calls using the same cookie file to pass the authentication check.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								curl -b cookie.txt "http://localhost:9001/api/v2/search?type=dataset& input=page"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								```