Spring Security: Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 33: Zeile 33:
</pre>
</pre>


== Links ==
== Registrierung und Login ==


[https://www.baeldung.com/registration-with-spring-mvc-and-spring-security?utm_source=email-newsletter&utm_medium=email&utm_campaign=broad_40_sec&tl_inbound=1&tl_target_all=1&tl_period_type=3 https://www.baeldung.com/registration-with-spring-mvc-and-spring-security?utm_source=email-newsletter&utm_medium=email&utm_campaign=broad_40_sec&tl_inbound=1&tl_target_all=1&tl_period_type=3]
=== Links ===
 
[https://www.baeldung.com/registration-with-spring-mvc-and-spring-security https://www.baeldung.com/registration-with-spring-mvc-and-spring-security]
 
[https://www.baeldung.com/securing-a-restful-web-service-with-spring-security https://www.baeldung.com/securing-a-restful-web-service-with-spring-security]
 
[https://www.baeldung.com/spring-security-session https://www.baeldung.com/spring-security-session]
 
[https://docs.spring.io/spring-session/docs/current/reference/html5/guides/java-rest.html https://docs.spring.io/spring-session/docs/current/reference/html5/guides/java-rest.html]
 
[https://gist.github.com/thomasdarimont/8d6bc243d3b504439e67d57cb0d0bb72 https://gist.github.com/thomasdarimont/8d6bc243d3b504439e67d57cb0d0bb72]
 
[https://www.sedooe.com/2016/04/rest-authentication-using-spring-security-and-spring-session/ https://www.sedooe.com/2016/04/rest-authentication-using-spring-security-and-spring-session/]




Zurück zu [[Spring#Spring Security|Spring]]
Zurück zu [[Spring#Spring Security|Spring]]

Aktuelle Version vom 7. Juni 2019, 08:19 Uhr

Noch in Bearbeitung


CORS (Cross Over Resource Sharing)

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
  ...
  @Override
  protected void configure(final HttpSecurity http) throws Exception {    
    http.cors() /* CORS filter must be enabled */
      .and()
      ...
  }

  ...

  @Bean
  CorsConfigurationSource corsConfigurationSource() {
    CorsConfiguration configuration = new CorsConfiguration();
    configuration.setAllowCredentials(true);
    configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type"));
    configuration.setAllowedOrigins(Arrays.asList("http://localhost:4200"));
    configuration.setAllowedMethods(Arrays.asList("GET","POST"));
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    source.registerCorsConfiguration("/**", configuration);
    return source;
  }
  ...
}

Registrierung und Login

Links

https://www.baeldung.com/registration-with-spring-mvc-and-spring-security

https://www.baeldung.com/securing-a-restful-web-service-with-spring-security

https://www.baeldung.com/spring-security-session

https://docs.spring.io/spring-session/docs/current/reference/html5/guides/java-rest.html

https://gist.github.com/thomasdarimont/8d6bc243d3b504439e67d57cb0d0bb72

https://www.sedooe.com/2016/04/rest-authentication-using-spring-security-and-spring-session/


Zurück zu Spring