Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 44b14b44

Přidáno uživatelem Jiri Trefil před asi 2 roky(ů)

#10228 Implementování odhlášení uživatele a invalidace tokenu

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/security/WebSecurityConfig.java
2 2

  
3 3
import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.AuthProvider;
4 4
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.boot.web.client.RestTemplateBuilder;
5 6
import org.springframework.context.annotation.Bean;
7
import org.springframework.context.annotation.Configuration;
6 8
import org.springframework.security.authentication.AuthenticationManager;
9
import org.springframework.security.authentication.AuthenticationProvider;
7 10
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
8 11
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
9 12
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
......
13 16
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
14 17
import org.springframework.web.client.RestTemplate;
15 18

  
19
@Configuration
16 20
@EnableWebSecurity
17 21
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
18 22

  
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/utils/RequestBuilder.java
21 21
        HttpHeaders headers = new HttpHeaders();
22 22
        headers.setContentType(MediaType.APPLICATION_JSON);
23 23
        HttpEntity<String> entity = new HttpEntity<>(json, headers);
24
        ResponseEntity<String> response = restTemplate.postForEntity(url, entity, String.class);
25

  
26
        return response;
24
        return restTemplate.postForEntity(url, entity, String.class);
27 25
    }
28 26

  
29 27
    public static ResponseEntity<String> sendRequestResponse(String url, HashMap<String,String> body, String token) {
src/main/resources/application.properties
27 27
logging.level.cz.zcu.fav.kiv.antipatterndetectionapp=TRACE
28 28

  
29 29
# security
30
auth.realm.login=http://localhost:8081/createJwt
30
auth.realm.login=http://localhost:8081/login
31
auth.realm.logout=http://localhost:8081/logout
31 32
auth.realm.authenticate=http://localhost:8081/authenticate

Také k dispozici: Unified diff