Skip to content

roost-io/spring-security-registration

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-security-registration

Spring-security-registration is a github repository serves as a sample project designed to illustrate the process of using RoostGPT (an AI-powered tool) which streamlines the mechanism of creating test cases, enabling developers to improve code quality and accelerate development workflows.

Overview

Spring-security-registration demonstrates the significance of thorough unit testing in Java projects, particularly within the Spring framework. By prioritizing unit tests, this project aims to ensure the reliability and correctness of the implemented functionalities.

Development Process

The development process of the spring-security-registration integrates cutting-edge AI-powered tools, notably RoostGPT, alongside established practices:

  1. Code Implementation:
    Java code is implemented following Spring framework conventions, with an emphasis on RESTful APIs and designs.

  2. Test Generation with RoostGPT:
    RoostGPT, an AI-powered test generator, is utilized to automate the generation of comprehensive unit tests. This innovative approach enhances test coverage and efficiency in the development process.

  3. Test Execution:
    Maven is used as the build automation tool to compile the code and execute both manually crafted and AI-generated unit tests. This ensures thorough validation of the application's functionality.

    Running Maven Tests

To run Maven tests for the Spring Boot Examples project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/roost-io/spring-security-registration.git
    
  2. Navigate to the project directory:

    cd spring-security-registration
  3. Run the unit tests:

    mvn test

    This command executes all unit tests defined within the project, providing feedback on test results and code coverage.

  4. (Optional) Run Specific Tests:
    If you want to run specific test classes or methods, you can use Maven's Surefire plugin to filter tests. Use the following command format:

    • To run a specific test class:

      mvn -Dtest=TestClassName test

      Replace TestClassName with the name of the class containing the tests you want to run.

    • To run a specific test method within a class:

      mvn -Dtest=TestClassName#testMethodName test

      Replace testMethodName with the name of the test method you want to run.

. Review Test Results:

After running the tests, review the output in the terminal. Maven will display information about the tests executed, including any failures or errors encountered.

Contact

For more information about RoostGPT or our other products and services, please visit our website at roost.ai or contact us at [email protected].

Login and Registration Example Project with Spring Security

If you're already a student of Learn Spring Security, you can get started diving deeper into registration with Module 2
If you're not yet a student, you can get access to the course here: https://bit.ly/github-lss


Relevant Articles:

Build and Deploy the Project

mvn clean install

This is a Spring Boot project, so you can deploy it by simply using the main class: Application.java

Once deployed, you can access the app at:

https://localhost:8081

Set up MySQL

By default, the project is configured to use the embedded H2 database. If you want to use the MySQL instead, you need to uncomment relevant section in the application.properties and create the db user as shown below:

mysql -u root -p 
> CREATE USER 'tutorialuser'@'localhost' IDENTIFIED BY 'tutorialmy5ql';
> GRANT ALL PRIVILEGES ON *.* TO 'tutorialuser'@'localhost';
> FLUSH PRIVILEGES;

Set up Email

You need to configure the email by providing your own username and password in application.properties You also need to use your own host, you can use Amazon or Google for example.

AuthenticationSuccessHandler configuration for Custom Login Page article

If you want to activate the configuration for the article Custom Login Page for Returning User, then you need to comment the @Component("myAuthenticationSuccessHandler") annotation in the MySimpleUrlAuthenticationSuccessHandler and uncomment the same in MyCustomLoginAuthenticationSuccessHandler.

Feature toggle for Geo IP Lib

The geolocation checks do not work for the IP addresses 127.0.0.1 and 0.0.0.0, which can be a problem when running the application locally or in a test environment. To enable/disable the check on the geolocation, set the property geo.ip.lib.enabled to true/false; this is false by default.

About

Go further into "Learn Spring Security":

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 86.2%
  • HTML 13.8%