Commit 45fa858a authored by jcorvi's avatar jcorvi
Browse files

work

parent bd25da49
......@@ -51,7 +51,27 @@
<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.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-client</artifactId>
</dependency> -->
</dependencies>
<build>
......
......@@ -22,6 +22,7 @@ public class DocumentController {
public List<Document> findAll() {
return documentService.findAll();
}
@RequestMapping("/documents/{id}")
public Document find(@PathVariable(value="id") Long id) {
return documentService.findByDocumentId(id);
......
......@@ -49,14 +49,14 @@ public class Finding {
@Field("ROUTE_OF_AMINISTRATION")
private Annotation route_of_administration;
@Field("DOSE_QUANTITY")
private Annotation dose_quantity;
@Field("DOSE_FREQUENCY")
private Annotation dose_frequency;
@Field("DOSE_DURATION")
private Annotation dose_duration;
// @Field("DOSE_QUANTITY")
// private Annotation dose_quantity;
//
// @Field("DOSE_FREQUENCY")
// private Annotation dose_frequency;
//
// @Field("DOSE_DURATION")
// private Annotation dose_duration;
@Field("STATISTICAL_SIGNIFICANCE")
private Annotation statistical_significance;
......@@ -226,30 +226,30 @@ public class Finding {
this.route_of_administration = route_of_administration;
}
public Annotation getDose_quantity() {
return dose_quantity;
}
public void setDose_quantity(Annotation dose_quantity) {
this.dose_quantity = dose_quantity;
}
public Annotation getDose_frequency() {
return dose_frequency;
}
public void setDose_frequency(Annotation dose_frequency) {
this.dose_frequency = dose_frequency;
}
public Annotation getDose_duration() {
return dose_duration;
}
public void setDose_duration(Annotation dose_duration) {
this.dose_duration = dose_duration;
}
// public Annotation getDose_quantity() {
// return dose_quantity;
// }
//
// public void setDose_quantity(Annotation dose_quantity) {
// this.dose_quantity = dose_quantity;
// }
//
// public Annotation getDose_frequency() {
// return dose_frequency;
// }
//
//
// public void setDose_frequency(Annotation dose_frequency) {
// this.dose_frequency = dose_frequency;
// }
//
// public Annotation getDose_duration() {
// return dose_duration;
// }
//
// public void setDose_duration(Annotation dose_duration) {
// this.dose_duration = dose_duration;
// }
public Annotation getDose() {
return dose;
......@@ -357,15 +357,18 @@ public class Finding {
if(this.getGroup()!=null) {
all.add(this.getGroup());
}
if(this.getDose_duration()!=null) {
all.add(this.getDose_duration());
}
if(this.getDose_quantity()!=null) {
all.add(this.getDose_quantity());
}
if(this.getDose_frequency()!=null) {
all.add(this.getDose_frequency());
if(this.getDose()!=null) {
all.add(this.getDose());
}
// if(this.getDose_duration()!=null) {
// all.add(this.getDose_duration());
// }
// if(this.getDose_quantity()!=null) {
// all.add(this.getDose_quantity());
// }
// if(this.getDose_frequency()!=null) {
// all.add(this.getDose_frequency());
// }
if(this.getStatistical_significance()!=null) {
all.add(this.getStatistical_significance());
}
......
package es.bsc.inb.ades.rest.api.security;
//@KeycloakConfiguration
public class SecurityConfig /*extends KeycloakWebSecurityConfigurerAdapter*/
{
// /**
// * Registers the KeycloakAuthenticationProvider with the authentication manager.
// */
// @Autowired
// public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// auth.authenticationProvider(keycloakAuthenticationProvider());
// }
//
// /**
// * Defines the session authentication strategy.
// */
// @Bean
// @Override
// protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
// return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
// }
//
// @Override
// protected void configure(HttpSecurity http) throws Exception
// {
// super.configure(http);
// http.authorizeRequests()
// .antMatchers("/greeting").hasRole("user")
// //.antMatchers("/admin*").hasRole("ADMIN") http://localhost:8087/greeting
// .anyRequest().permitAll();
// }
//
// @Bean
// public KeycloakSpringBootConfigResolver KeycloakConfigResolver() {
// return new KeycloakSpringBootConfigResolver();
// }
}
package es.bsc.inb.ades.rest.api.security;
import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
public class SecurityConfiguration /*extends WebSecurityConfigurerAdapter */{
// @Override
// public void configure(HttpSecurity http) throws Exception {
// http.authorizeRequests()
// .anyRequest().authenticated()
// .and()
// .oauth2Login();
// }
}
\ No newline at end of file
package es.bsc.inb.ades.rest.api.security;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.security.Principal;
@Controller
public class WebController {
@RequestMapping("/")
public String index(Model model, Principal principal) {
return "index";
}
@GetMapping("/greeting")
public String greeting(@RequestParam(name="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "index";
}
}
\ No newline at end of file
......@@ -4,3 +4,23 @@ spring.application.name =ades_rest_api
server.port = 8090
#ADES Database
spring.data.mongodb.uri=mongodb://localhost:27017/etransafe
##custom security
#spring.security.oauth2.client.registration.custom-client.client-id=R2dpxQ3vPrtfgF72
#spring.security.oauth2.client.registration.custom-client.client-secret=fDw7Mpkk5czHNuSRtmhGmAGL42CaxQB9
#spring.security.oauth2.client.registration.custom-client.client-name=Auth Server
#
#
#
#####spring.security.oauth2.client.registration.custom-client.scope=user_info
#spring.security.oauth2.client.registration.custom-client.provider=custom-provider
#spring.security.oauth2.client.registration.custom-client.redirect-uri-template=http://localhost:8090/login/oauth2/code/
#spring.security.oauth2.client.registration.custom-client.client-authentication-method=basic
#spring.security.oauth2.client.registration.custom-client.authorization-grant-type=authorization_code
#spring.security.oauth2.client.provider.custom-provider.token-uri=http://localhost:8085/auth/oauth/token
#spring.security.oauth2.client.provider.custom-provider.authorization-uri=http://localhost:8085/auth/oauth/authorize
#spring.security.oauth2.client.provider.custom-provider.user-info-uri=http://localhost:8085/auth/user/me
#spring.security.oauth2.client.provider.custom-provider.user-name-attribute=name
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