@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