From 7fcdc1c788725f866de71fc9dfd8c4d1cb132b57 Mon Sep 17 00:00:00 2001 From: Orangerot Date: Fri, 24 May 2024 17:42:08 +0200 Subject: Initial commit --- .../diagrams/classdiagram-authentication.puml | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 11-entwurfsheft-kolloquium/assets/diagrams/classdiagram-authentication.puml (limited to '11-entwurfsheft-kolloquium/assets/diagrams/classdiagram-authentication.puml') diff --git a/11-entwurfsheft-kolloquium/assets/diagrams/classdiagram-authentication.puml b/11-entwurfsheft-kolloquium/assets/diagrams/classdiagram-authentication.puml new file mode 100644 index 0000000..a2b3518 --- /dev/null +++ b/11-entwurfsheft-kolloquium/assets/diagrams/classdiagram-authentication.puml @@ -0,0 +1,112 @@ +@startuml + +package authenticationAPI <> { + package authenticationDataAccessLayer <> { + ' interface AuthenticationDao { + ' String login(String username) + ' int logout(String username) + ' } + + ' class AuthenticationDataAccessService <<@Respository>> { + ' <> AuthenticationDataAccessService(JpaTemplate jpaTemplate) + ' String login(String username) + ' int logout(String username) + ' } + + interface UserDetailsManager { + void createUser(UserDetails userDetails) + void changePassword(String oldPassword, String newPassword) + void deleteUser(String username) + void updateUser(UserDetails user) + boolean userExists(String username) + } + note left + Aus org.springframework.security.provisioning + - liefert Methoden zum Erstellen neuer User + und zum Aktualisieren bestehender. + end note + + class JdbcUserDetailsManager <<@Repository>> { + <> JdbcUserDetailsManager(DataSource dataSource) + void createUser(UserDetails user) + void changePassword(String oldPassword, String newPassword) + void deleteUser(String username) + void updateUser(UserDetails user) + boolean userExists(String username) + } + note right + User Management Service aus dem Paket + org.springframework.security.provisioning + der CRUD Operationen für User bereitstellt. + Hier sind nur die relevanten Methoden modelliert. + end note + } + + package authenticationService <> { + class AuthenticationService <<@Service>> { + -- + <> AuthenticationService(UserDetailsManager userDetailsManager) + List verifyLogin(String username) + int logout(String username) + int forgotPassword(ForgotPasswordRequest forgotPasswordRequest) + .. via JdbcUserDetailsManager .. + int resetPassword(String username, RequestWithPassword requestWithPassword) + int registerUser(UserDetails user) + int changePassword(String username, ChangePasswordRequest changePasswordRequest) + int deleteUser(String username, RequestWithPassword requestWithPassword) + } + + class JavaMailSenderImpl {} + note left + Aus org.springframework.mail.javamail. + Implementierung des JavaMailSender Interfaces, + welches das MailSender Interface durch Unterstützung + von MIME Nachrichten erweitert. + Das MailSender Interface definiert dabei eine + Strategie zum Versenden einfacher Mails. + Unterstützt sowohl JavaMail MimeMessages und + Spring SimpleMailMessages. + end note + } + + package authenticationController <> { + class AuthenticationController <<@Controller>> { + <> AuthenticationController(AuthenticationService authenticationService) + ResponseEntity> verifyLogin(String username) + ResponseEntity logout(String username) + ResponseEntity forgotPassword(ForgotPasswordRequest forgotPasswordRequest) + ResponseEntity resetPassword(String username, RequestWithPassword requestWithPassword) + ResponseEntity registerUser(UserDetails user) + ResponseEntity changePassword(String username, ChangePasswordRequest changePasswordRequest) + ResponseEntity deleteUser(String username, RequestWithPassword requestWithPassword) + } + + class ChangePasswordRequest { + <> ChangePasswordRequest(String oldPassword, String newPassword) + String getOldPassword() + String getNewPassword() + } + + class ForgotPasswordRequest { + <> ForgotPasswordRequest(String email) + String getEmail() + } + + class RequestWithPassword { + <> ResetPasswordRequest(String password) + String getPassword() + } + } +} + +' User <.. AuthenticationDataAccessService: DB +' User <.. JdbcUserDetailsManager: DB +UserDetailsManager <.. AuthenticationService: <> +' AuthenticationDao <.. AuthenticationService: <> +AuthenticationService --o AuthenticationController +' AuthenticationDao <|. AuthenticationDataAccessService: <> +UserDetailsManager <|. JdbcUserDetailsManager: <> +JavaMailSenderImpl <. AuthenticationService: <> + +@enduml + -- cgit v1.2.3