Skip to content

Commit

Permalink
Merge pull request #1 from opensrp/40-keycloak-integration
Browse files Browse the repository at this point in the history
40 : Add keycloak authentication in jpa server starter
  • Loading branch information
rehammuzzamil authored Jun 28, 2021
2 parents 9a1e333 + ac76585 commit 5e39957
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
<classifier>classes</classifier>
</dependency>

<dependency>
<groupId>org.smartregister</groupId>
<artifactId>hapi-fhir-keycloak</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<!-- HAPI-FHIR uses Logback for logging support. The logback library is included automatically by Maven as a part of the hapi-fhir-base dependency, but you also need to include a logging library. Logback
is used here, but log4j would also be fine. -->
<dependency>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/ca/uhn/fhir/jpa/starter/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
Expand All @@ -25,6 +27,7 @@
JpaRestfulServer.class})
@SpringBootApplication(exclude = {ElasticsearchRestClientAutoConfiguration.class})
@Import({SubscriptionSubmitterConfig.class, SubscriptionProcessorConfig.class, SubscriptionChannelConfig.class, WebsocketDispatcherConfig.class, MdmConfig.class})
@EnableAutoConfiguration(exclude = {ErrorMvcAutoConfiguration.class})
public class Application extends SpringBootServletInitializer {

public static void main(String[] args) {
Expand Down
22 changes: 18 additions & 4 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
spring:
main:
allow-bean-definition-overriding: true
datasource:
url: 'jdbc:h2:file:./target/database/h2'
url: 'jdbc:postgresql://localhost:5432/hapi_fhir'
#url: jdbc:h2:mem:test_mem
username: sa
password: null
driverClassName: org.h2.Driver
username: postgres
password: root
driverClassName: org.postgresql.Driver
max-active: 15

# database connection pool size
Expand Down Expand Up @@ -153,3 +155,15 @@ hapi:
# protocol: 'http'
# schema_management_strategy: CREATE
# username: SomeUsername
#security:
# ignored: none
keycloak:
auth-server-url: http://localhost:8180/auth/
realm: fhir-core
resource: fhir-core-server
credentials:
secret: b7747a19-f72f-4906-8892-8438ce2492be
ssl-required: external
# use-resource-role-mappings: true,
logging.level.org.springframework.web: trace
logging.level.org.apache: trace

0 comments on commit 5e39957

Please sign in to comment.