Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ChatGPT - Code formatter #1052

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from

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

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
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