Skip to content

Conversation

christolis
Copy link
Member

Closes #813.

@christolis christolis added enhancement New feature or request priority: normal labels Mar 12, 2024
@christolis christolis self-assigned this Mar 12, 2024
@christolis christolis marked this pull request as ready for review March 12, 2024 17:33
@christolis christolis requested a review from a team as a code owner March 12, 2024 17:33
Taz03
Taz03 previously approved these changes Mar 16, 2024
@Taz03 Taz03 dismissed their stale review March 16, 2024 09:40

changes required

@christolis christolis force-pushed the feature/gpt-formatter branch from 3fb8cea to 525f249 Compare March 19, 2024 20:55
@christolis christolis requested review from Taz03 and ankitsmt211 March 19, 2024 21:02
@christolis christolis force-pushed the feature/gpt-formatter branch from 525f249 to 4548a6b Compare March 19, 2024 21:08
Taz03
Taz03 previously approved these changes Mar 19, 2024
ankitsmt211
ankitsmt211 previously approved these changes Mar 27, 2024
Copy link
Member

@ankitsmt211 ankitsmt211 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍

@ankitsmt211 ankitsmt211 dismissed their stale review March 27, 2024 08:44

blocking

@ankitsmt211
Copy link
Member

i tried running a random snippet but results were unexpected,

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    // this you get for free when you configure the db connection in application.properties file
    @Autowired
    private DataSource dataSource;

    // this bean is created in the application starter class if you're looking for it
    @Autowired
    private PasswordEncoder encoder;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
        .csrf().disable()
        .authorizeRequests()
        .antMatchers(HttpMethod.OPTIONS, "/api/**").permitAll() // For CORS, the preflight request
        .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()     // will hit the OPTIONS on the route
        .antMatchers("/api/**").authenticated() // Requests for our REST API must be authorized.
        .anyRequest().permitAll()               // All other requests are allowed without authorization.
        .and()
        .httpBasic();                           // Use HTTP Basic Authentication

        http
        .sessionManagement()
        .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        String userQuery = "SELECT username, password, enabled FROM User WHERE username=?";
        String authQuery = "SELECT username, role FROM User WHERE username=?";
        auth
        .jdbcAuthentication()
        .dataSource(dataSource)
        .usersByUsernameQuery(userQuery)
        .authoritiesByUsernameQuery(authQuery)
        .passwordEncoder(encoder);
    }
}@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    // this you get for free when you configure the db connection in application.properties file
    @Autowired
    private DataSource dataSource;

    // this bean is created in the application starter class if you're looking for it
    @Autowired
    private PasswordEncod

OUTPUT:

er encoder;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .csrf().disable()
            .authorizeRequests()
                .antMatchers(HttpMethod.OPTIONS, "/api/**").permitAll() // For CORS, the preflight request
                .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()     // will hit the OPTIONS on the route
                .antMatchers("/api/**").authenticated() // Requests for our REST API must be authorized.
                .anyRequest().permitAll()               // All other requests are allowed without authorization.
            .and()
            .httpBasic();                           // Use HTTP Basic Authentication

        http
            .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        String userQuery = "SELECT username, password, enabled FROM User WHERE username=?";
        String authQuery = "SELECT username, role FROM User WHERE username=?";
        auth
            .jdbcAuthentication()
                .dataSource(dataSource)
                .usersByUsernameQuery(userQuery)
                .authoritiesByUsernameQuery(authQuery)
                .passwordEncoder(encoder);
    }
}

It's not complete output and always same as well, the length is less than 2k this is gpt formatting at work

@Taz03 Taz03 dismissed their stale review March 27, 2024 10:18

not reliable

@christolis christolis marked this pull request as draft April 4, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: normal
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

ChatGPT - Code formatter
3 participants