Skip to content
Snippets Groups Projects
Commit 87c9076a authored by usuario's avatar usuario
Browse files

Change to remove ssl and keycloak

parent bc32f1f6
No related tags found
No related merge requests found
......@@ -2,5 +2,4 @@ FROM openjdk:11-jdk-slim
WORKDIR tmp
COPY *.jar datausage.jar
COPY etc/platoon_datausage_cape.properties /etc/platoon_datausage_cape.properties
COPY etc/keycloak/keystore.jks /etc/keycloak/keystore.jks
ENTRYPOINT ["java","-jar","datausage.jar"]
No preview for this file type
File deleted
......@@ -257,7 +257,7 @@
<version>1.5.9</version>
</dependency>
<!-- oauth -->
<dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
<version>2.5.0</version>
......@@ -267,7 +267,7 @@
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
<version>2.5.0</version>
</dependency>
-->
<!--
......
......@@ -25,7 +25,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = { "com.tecnalia.datausage", "com.tecnalia.datausage.api" , "com.tecnalia.datausage.configuration",
@ComponentScan(basePackages = { "com.tecnalia.datausage", "com.tecnalia.datausage.api",
"com.tecnalia.datausage.utils", "io.dataspaceconnector.services.usagecontrol"})
public class Swagger2SpringBoot {
......@@ -35,33 +35,6 @@ public class Swagger2SpringBoot {
new SpringApplication(Swagger2SpringBoot.class).run(args);
}
@Bean
public OpenAPI openApi(@Value("${server.servlet.context-path}") String contextPath,
@Value("${spring.security.oauth2.resourceserver.jwt.issuer-uri}") String issuerUri) {
return new OpenAPI()
.info(new Info()
.title("Platoon Data Usage")
.description("Api Documentation")
.termsOfService("")
.version("1.0")
.license(new License()
.name("Apache 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0"))
.contact(new io.swagger.v3.oas.models.info.Contact()
.email("")))
.addServersItem(new Server().url(contextPath))
.components(new Components()
.addSecuritySchemes("openid-connect",
new SecurityScheme().type(SecurityScheme.Type.OPENIDCONNECT)
.openIdConnectUrl(issuerUri + "/.well-known/openid-configuration"))
.addSecuritySchemes("bearer-jwt",
new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer")
.bearerFormat("JWT")))
.addSecurityItem(new SecurityRequirement().addList("bearer-jwt", Arrays.asList("read", "write")))
.addSecurityItem(new SecurityRequirement().addList("openid-connect", Arrays.asList("read", "write")));
}
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.tecnalia.datausage.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
/**
*
* @author root
*/
@Configuration
public class JWTSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${spring.profiles.active:Unknown}")
private String activeProfile;
@Override
public void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().formLogin().disable().headers().httpStrictTransportSecurity().disable().and()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.ALWAYS).and()
.authorizeRequests(authz -> authz.antMatchers("/swagger-ui.html", "/swagger-ui/**","/v3/api-docs/**","/platoontec/**")
.permitAll().anyRequest().authenticated())
.oauth2ResourceServer(oauth2 -> oauth2.jwt());
}}
......@@ -3,8 +3,8 @@ server.servlet.contextPath=/platoontec/PlatoonDataUsage/1.0
#
#/platoon-data-usage
#
#server.port=8080
server.port=443
server.port=8080
spring.jackson.date-format=com.tecnalia.datausage.RFC3339DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
......@@ -20,8 +20,12 @@ spring.jackson.deserialization.fail-on-unknown-properties=true
#spring.jpa.database=POSTGRESQL
spring.datasource.platform = usagecontrol
#spring.datasource.url = jdbc:postgresql://localhost:5432/usagecontrol
spring.datasource.url = jdbc:postgresql://postgres:5432/usagecontrol
#spring.datasource.url = jdbc:postgresql://postgres:5432/usagecontrol
spring.datasource.username = connector
#spring.datasource.username = postgres
spring.datasource.password = 12345
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
......@@ -35,10 +39,6 @@ spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect
## General Information
title=@project.name@
version=@project.version@
......@@ -63,25 +63,8 @@ spring.jpa.hibernate.ddl-auto=update
#Keycloak
spring.security.oauth2.resourceserver.jwt.issuer-uri=https://platoon.tecnalia.com:8443/auth/realms/platoon
#ssl settings
# The format used for the keystore. It could be set to JKS in case it is a JKS file
server.ssl.key-store-type=JKS
# The path to the keystore containing the certificate
#server.ssl.key-store=classpath:keystore.jks
server.ssl.key-store=file:/etc/keycloak/keystore.jks
# The password used to generate the certificate
server.ssl.key-store-password=tecnalia2021
# The alias mapped to the certificate
server.ssl.key-alias=1
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment