Сообщения

MS Lesson22: Spring Security Project

Step1: docker-compose.yaml fayli services : postgres : image : postgres:17 container_name : security2 environment : POSTGRES_DB : security2 POSTGRES_USER : security2 POSTGRES_PASSWORD : security2 ports : - "5555:5432" volumes : - postgres_data:/var/lib/postgresql/data networks : - demo-network networks : demo-network : driver : bridge volumes : postgres_data :   application.yaml fayli server : port : 9999 spring : profiles : include : - db application-db.yaml fayli spring : datasource : url : jdbc:postgresql://${ DB_HOSTNAME :localhost}:${ DB_PORT :5555}/security2 username : security2 password : security2 driver-class-name : org.postgresql.Driver jpa : hibernate : ddl-auto : update show-sql : true properties : hibernate : format_sql : true Step2: Entity-leri yaratmaq User entity package az . etibarli . step3 . entity ; import jakarta . pers...

MS Lesson 21: Spring Security

Изображение
1. Authentication vs Authorization * Authentication - "Who are you?" Istifadecinin kimliyinin yoxlanilmasi. Esasen username ve passwordun yoxlanilmasi. Dogru olmadigi halda 401 Unauthorized xetasi verir. * Authorization - "What can you do?" Authentifikasiya olunmush istifadecinin hansi emeliyyatlara icazesi oldugunun yoxlanilmasi.  Dogru olmadigi halda 403 (Forbidden) xetasi verir. 2. Spring Security internal flow Authentication - login melumatlarini dashiyan Java obyektidir. Authentication auth = new UsernamePasswordAuthenticationToken ( " admin ", // username (principal) " 12345 ", // password (credentials) null // authorities (hələ yoxdur) ); AuthenticationManager - Authentication prosesini idare eden koordinator. Default implementasiya ProviderManager. Filter-den Authentication obyektini alir, hansi AuthenticationProvider-in ishleyeceyini secir, Provider-e oturur.  AuthenticationProvider - esl Authentication...