Spring Security Issue

It is assumed that
- errors in WebSecurity.java occured due to typo or incorrect package import.
- failure of sending Http post request through Postman is caused as previous request created after endpoint change could not aceept the change for some reason.


# What I did for fix

- removed Spring security dependency to turn it back to previous state which has no authorization process.
- tested request by creating new request in Postman

* It is found that additional configuration (spring.datasource.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=false) does not affect server operation for now.






---------------------------------------------------------------------------------------------------------------------

prerequisite : password field should be removed from UserEntity.java


<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

1. remove above dependency from pom.xml and save the file

2. close eclipse

3. remove all sub folders in 'repository' folder (the location of 'repository' folder would look like this -> C:\Users\Claire Min\.m2\repository)

4. open eclipse and pom.xml and just add some empty space and save the pom.xml
Operation of building workspace will start. Wait til it is completed.

5.remove the security package we created under our project
6. refresh project

7. modify the following 3 files
Main.java
UserService.java
UserServiceImpl.java

8. run app server

9. test GET and POST request with postman (when testing GET request, use encrpted userId stored in DB)

ex) http://localhost:8080/users/znatyb3iqtIBKT6kr7wsens1ploQNR


-----------------------------------------------------------------------------------------------------------------------


1. backup project under workspace

2. update pom.xml

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

2.run the project and check if a security password is generated

3. try post request using postman (401)
   and get request using web browser (user , pw) ex) http://localhost:8080/users/8OMqsBlqCto3AKq4WpD5BA56oMyx1u

4.remove all comment from main.java for bCrypted
  and serviceimpl for autowired bCrypted and encoder code


5. Create Security package
-websecurity.jva

userService
userServiceImpl



spring.datasource.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=false







Comments

Popular posts from this blog

Portlet Edit Mode (Portlet preference) to replace Portlet configuration

GoGo Shell & What can be deleted in Liferay Instance