Commit bd25da49 authored by jcorvi's avatar jcorvi
Browse files

docker container and compose configuration

parent 3d8ba5a0
......@@ -11,3 +11,5 @@ RUN chmod u=rwx,g=rwx,o=r /usr/local/share/rest_api -R
RUN docker-build.sh ${REST_API_VERSION}
CMD /usr/local/bin/ades-rest-api
\ No newline at end of file
......@@ -34,7 +34,7 @@ mv target/ades-rest-api-0.0.1-SNAPSHOT.jar ades-rest-api-${REST_API_VERSION}.jar
cat > /usr/local/bin/ades-rest-api <<EOF
#!/bin/sh
exec java \$JAVA_OPTS -jar "${ADES_RELATION_HOME}/ades-rest-api-${REST_API_VERSION}.jar" -workdir "${REST_API_HOME}" "\$@"
exec java \$JAVA_OPTS -jar "${REST_API_HOME}/ades-rest-api-${REST_API_VERSION}.jar" -workdir "${REST_API_HOME}" "\$@"
EOF
chmod +x /usr/local/bin/ades-rest-api
......
......@@ -51,32 +51,18 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
......
......@@ -6,7 +6,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan("es.bsc.inb.ades.api")
@ComponentScan("es.bsc.inb.ades")
public class App {
public static void main(String[] args) {
......
package es.bsc.inb.ades.rest.api.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource({ "classpath:ades_rest_api.properties" })
public class Config{
}
......@@ -4,7 +4,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource({ "classpath:ades_rest_api.properties" })
public class PersistenceJPAConfig{
......
package es.bsc.inb.ades.rest.api.controllers;
import org.apache.catalina.filters.CorsFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class CustomWebSecurityConfigurerAdapter<MyBasicAuthenticationEntryPoint> extends WebSecurityConfigurerAdapter {
@Autowired
private MyBasicAuthenticationEntryPoint authenticationEntryPoint;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user1").password(passwordEncoder().encode("user1Pass"))
.authorities("ROLE_USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/securityNone").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic()
.authenticationEntryPoint((AuthenticationEntryPoint) authenticationEntryPoint);
http.addFilterAfter(new CorsFilter(),
BasicAuthenticationFilter.class);
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
spring.application.name =ades_rest_api
#Spring Boot Port
server.port = ${SERVER_PORT}
#ADES Database
spring.data.mongodb.uri=${MONGO_URI}/etransafe
spring.application.name =ades_rest_api
#Spring Boot Port
#server.port = ${SERVER_PORT}
server.port = 8090
#ADES Database
spring.data.mongodb.uri=mongodb://localhost:27017/etransafe
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment