Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring安全性中保护字符串查询的问题_Java_Spring_Authentication_Encryption_Spring Security - Fatal编程技术网

Java Spring安全性中保护字符串查询的问题

Java Spring安全性中保护字符串查询的问题,java,spring,authentication,encryption,spring-security,Java,Spring,Authentication,Encryption,Spring Security,我对Spring安全性非常陌生,我想看看是否有一种方法可以保护这些查询字符串,这样当您执行诸如“登录”之类的操作时,它们就不会出现在开发人员控制台中,但仍然可以在我的springboot服务(如UserService)中访问 有没有一种我不知道的加密方法?我有点困惑,不知道最好的方法是什么 (我的项目使用的是vue前端,而不是内置的Springboot登录等) 我的网站安全配置- @Configuration @EnableWebSecurity public class WebSecurity

我对Spring安全性非常陌生,我想看看是否有一种方法可以保护这些查询字符串,这样当您执行诸如“登录”之类的操作时,它们就不会出现在开发人员控制台中,但仍然可以在我的springboot服务(如UserService)中访问

有没有一种我不知道的加密方法?我有点困惑,不知道最好的方法是什么

(我的项目使用的是vue前端,而不是内置的Springboot登录等)

我的网站安全配置-

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    public static final String AUTHORITY_QUERY = "SELECT email, password, firstName, lastName, phoneNumber FROM ***.user";
    public static final String USERS_QUERY = "INSERT INTO ***.user (firstName, lastName, phoneNumber,email,password,emailIsVerified,agreedToTermsOfService,dateTimeCreated,psapAffiliationHasBeenVerified,hasSeenWalkthrough,isAdmin,is_enabled) values(:firstName, :lastName, :phoneNumber,:email,:password,0,0,now(),0,0,0,1)";
    public static final String CONFIRMATION_QUERY = "INSERT INTO ***.user (phoneNumber,email,password,emailIsVerified,agreedToTermsOfService,companyName,is_enabled) values(:phoneNumber,:email,:password,1,1,:companyName,1)";

    @Autowired
    private DataSource dataSource;

    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder(20);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.jdbcAuthentication()
                .usersByUsernameQuery(USERS_QUERY)
                .authoritiesByUsernameQuery(AUTHORITY_QUERY)
                .dataSource(dataSource);
    }

    protected void configure(HttpSecurity http) throws Exception {
        http
                .cors()
                .and()
                .csrf().disable()
                .anonymous().disable()
                .authorizeRequests()
                .antMatchers("/api").permitAll()
                .antMatchers(HttpMethod.OPTIONS, "/**").permitAll();
    }
}
用户服务示例-

public void confirmNewUserAccount(User user) {
    if(user.getEmailVerificationCode() != null) {
        namedParameterJdbcTemplate.update(WebSecurityConfig.CONFIRMATION_QUERY, new BeanPropertySqlParameterSource(user));
        System.out.println("Account verified");
    } else {
        new ResponseEntity<Error>(HttpStatus.CONFLICT);
    }
}
public void confirmNewUserAccount(用户){
if(user.getEmailVerificationCode()!=null){
namedParameterJdbcTemplate.update(WebSecurityConfig.CONFIRMATION_查询,新BeanPropertySqlParameterSource(用户));
系统输出打印项次(“账户验证”);
}否则{
新的响应(HttpStatus.CONFLICT);
}
}

您可以在登录时隐藏孔类console@MedElgarnaoui我对你的意思有点困惑。隐藏该类以防登录?保密你是说?意味着把它藏起来