Skip to content

Commit

Permalink
Bug Fix Packages🫸🌀✏️📗 :octocat:🐧🐳⬆
Browse files Browse the repository at this point in the history
  • Loading branch information
hendisantika committed Jun 25, 2024
1 parent 42bdaac commit d2e4443
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.hendisantika.adminlte.model;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;

import java.io.Serializable;

@MappedSuperclass
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/com/hendisantika/adminlte/model/Customers.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package com.hendisantika.adminlte.model;

import lombok.*;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import java.util.Date;

@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.hendisantika.adminlte.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.JdbcUserDetailsManager;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

import javax.sql.DataSource;
Expand All @@ -20,32 +21,32 @@

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public class WebSecurityConfig {

@Autowired
private DataSource datasource;

@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/bower_components/**", "/dist/**", "/plugins/**").permitAll()
@Bean
public SecurityFilterChain configure(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((req) -> req
.requestMatchers("/bower_components/**", "/dist/**", "/plugins/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
)
.formLogin((formLogin) -> formLogin
.failureUrl("/login?error")
.loginPage("/login")
.defaultSuccessUrl("/")
.permitAll()
.and()
.logout()
.permitAll())
.logout(logout -> logout
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login")
.permitAll();
.permitAll());
return http.build();
}

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//Use Spring Boots User detailsMAnager
//Use Spring Boots User detailsManager
JdbcUserDetailsManager userDetailsService = new JdbcUserDetailsManager();

//Set our Datasource to use the one defined in application.properties
Expand Down

0 comments on commit d2e4443

Please sign in to comment.