[v0.0.2] Adds Google and Github OAuth2 Authentication
Adds to the API the feature of OAuth2 Authentication via two providers: Google and Github. For that the tests were updated.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.hideyoshi.backendportfolio.base.user.repo;
|
||||
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.Provider;
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.Role;
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.User;
|
||||
import com.hideyoshi.backendportfolio.base.user.model.UserDTO;
|
||||
@@ -58,13 +59,14 @@ class UserRepositoryTest {
|
||||
}
|
||||
|
||||
private User createEntity() {
|
||||
return new UserDTO(
|
||||
"Clark Kent",
|
||||
"superman@gmail.com",
|
||||
"Superman",
|
||||
"password",
|
||||
List.of(Role.USER)
|
||||
).toEntity();
|
||||
return UserDTO.builder()
|
||||
.name("Clark Kent")
|
||||
.email("superman@gmail.com")
|
||||
.username("Superman")
|
||||
.password("password")
|
||||
.provider(Provider.LOCAL)
|
||||
.roles(List.of(Role.USER))
|
||||
.build().toEntity();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.hideyoshi.backendportfolio.base.user.service;
|
||||
|
||||
import com.hideyoshi.backendportfolio.base.security.service.AuthService;
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.Provider;
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.Role;
|
||||
import com.hideyoshi.backendportfolio.base.user.entity.User;
|
||||
import com.hideyoshi.backendportfolio.base.user.model.UserDTO;
|
||||
@@ -349,15 +350,15 @@ class UserServiceImplTest {
|
||||
}
|
||||
|
||||
private UserDTO createUser() {
|
||||
UserDTO userCreated = new UserDTO(
|
||||
"Clark Kent",
|
||||
"superman@gmail.com",
|
||||
"Superman",
|
||||
"password",
|
||||
List.of(Role.USER)
|
||||
);
|
||||
userCreated.setId(1L);
|
||||
return userCreated;
|
||||
return UserDTO.builder()
|
||||
.id(1L)
|
||||
.name("Clark Kent")
|
||||
.email("superman@gmail.com")
|
||||
.username("Superman")
|
||||
.password("password")
|
||||
.provider(Provider.LOCAL)
|
||||
.roles(List.of(Role.USER))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user