package com.nikola.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
@Configuration //klasata mora da bide anotirana so @Configuration bidejki e configuration klasa
@EnableWebSecurity //so anotiranje na @EnableWebSecurity kazuvame deka vo ovaa klasa ke implementirame se
//za security za nasata aplikacija
public class ApplicationSecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests()//authoriziraj gi
.antMatchers("/","index","/css/*","/js/*")
.permitAll()
.anyRequest()//sekoj request
.authenticated()//mora da bide avtenticiran
.and()//i
.httpBasic();//mehanizmot koi sakame da go koristime e http Basic
return http.build();
}
}
Я пытаюсь посмотреть это видео: .
Но у меня возникла ошибка:Description Resource Path Location Type
The method antMatchers(String, String, String, String) is undefined for the type AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry ApplicationSecurityConfig.java /Spring-Boot-Security-Tutorial-NovoVideo/src/main/java/com/nikola/security line 19 Java Problem
Подробнее здесь: https://stackoverflow.com/questions/754 ... tsconfigur
Метод antMatchers() не определен для типа AuthorizeHttpRequestsConfigurer.AuthorizedUrl ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Ошибка имени: K не определен (даже если K уже определен и используется)
Anonymous » » в форуме Python - 0 Ответы
- 48 Просмотры
-
Последнее сообщение Anonymous
-