@startuml
' skinparam linetype ortho
' skinparam groupInheritance 2
allowmixing
package subscriptionsAPI <> {
package subscriptionDataAccessLayer <> {
class SubscriptionDataAccessService <<@Repository>> {
<> SubscriptionDataAccessService(JpaTemplate jpaTemplate)
int uploadSubscriptions(String username, List subscriptions)
List getSubscriptions(String username)
List getSubscriptionsSince(String username, LocalDateTime time)
int addSubscriptions(String username, List addedSubscriptions)
int removeSubscriptions(String username, List removedSubscriptions)
List getTitles(String username)
}
interface SubscriptionDao {
int uploadSubscriptions(String username, List subscriptions)
List getSubscriptions(String username)
List getSubscriptionsSince(String username, LocalDateTime time)
int addSubscriptions(String username, List addedSubscriptions)
int removeSubscriptions(String username, List removedSubscriptions)
List getTitles(String username)
}
}
package subscriptionService <> {
class SubscriptionService <<@Service>> {
<> SubscriptionService(SubscriptionDao subscriptionDao)
int uploadSubscriptions(String username, List subscriptions)
List getSubscriptions(String username)
List getSubscriptionsSince(String username, LocalDateTime time)
int addSubscriptions(String username, List addedSubscriptions)
int removeSubscriptions(String username, List removedSubscriptions)
List getTitles(String username)
}
}
package subscriptionController <> {
class SubscriptionController <<@Controller>>{
' @Autowired
<> SubscriptionController(SubscriptionService subscriptionService)
' @GetMapping
ResponseEntity> getSubscriptions(String username, String deviceID, String functionJSONP)
' @PutMapping
ResponseEntity uploadSubscriptions(String username, String deviceID, List subscriptions)
' @PostMapping
ResponseEntity applySubscriptionDelta(String username, String deviceID, SubscriptionDelta delta)
' @GetMapping
ResponseEntity getSubscriptionDelta(String username, String deviceID, long since)
ResponseEntity> getTitles(String username, String deviceID)
}
class SubscriptionTitles {
<> SubscriptionTitles(Subscription subscription, List episodeTitles)
Subscription getSubscription()
List getEpisodesTitles()
}
class SubscriptionDelta {
<> SubscriptionDelta(List add, List remove)
List getRemove()
LocalDate getTimestamp()
List> getUpdate_urls()
}
}
}
package episodeActionsAPI <> {
package episodeActionDataAccessLayer <> {
class EpisodeActionDataAccessService <<@Repository>> {
<> EpisodeActionDataAccessService (JpaTemplate jpaTemplate)
long addEpisodeActions(String username, List episodeActionPosts)
List getEpisodeActions(String username)
List getEpisodeActionsOfPodcast(String username, String podcastURL)
List getEpisodeActionsSince(String username, LocalDateTime since)
List getEpisodeActionsOfPodcastSince(String username, String podcastURL, LocalDateTime since)
}
interface EpisodeActionDao {
long addEpisodeActions(String username, List episodeActionPosts)
List getEpisodeActions(String username)
List getEpisodeActionsOfPodcast(String username, String podcastURL)
List getEpisodeActionsSince(String username, LocalDateTime since)
List getEpisodeActionsOfPodcastSince(String username, String podcastURL, LocalDateTime since)
}
}
package episodeActionService <> {
class EpisodeActionService <<@Service>> {
<> EpisodeActionService (EpisodeActionDao episodeActionDao)
LocalDateTime addEpisodeActions(String username, List episodeActionPosts)
List getEpisodeActions(String username)
List getEpisodeActionsOfPodcast(String username, String podcastURL)
List getEpisodeActionsSince(String username, LocalDateTime since)
List getEpisodeActionsOfPodcastSince(String username, String podcastURL, LocalDateTime since)
}
}
package episodeActionController <> {
class EpisodeActionController <<@Controller>>{
<> EpisodeActionController (EpisodeActionService episodeActionService)
ResponseEntity addEpisodeActions(String username, EpisodeActionPostRequest episodeActionPostRequest)
ResponseEntity getEpisodeActions(String username, String deviceID, boolean aggregated)
ResponseEntity getEpisodeActionsOfPodcast(String username, String podcastURL, String deviceID, boolean aggregated)
ResponseEntity getEpisodeActionsSince(String username, String deviceID, long since, boolean aggregated)
ResponseEntity getEpisodeActionsOfPodcastSince(String username, String podcastURL, String deviceID, long since, boolean aggregated)
}
class EpisodeActionPostResponse {
<> EpisodeActionPostResponse(List> updateURLs)
long getTimestamp()
List> getUpdatedURLs()
}
class EpisodeActionPost {
<> EpisodeActionPost(String podcastURL, String episodeURL, Action action, LocalDateTime timestamp, int started, int position)
String getPodcastURL()
String getEpisodeURL()
int getGUID()
Action getAction()
LocalDateTime getTimestamp()
int getStarted()
int getPosition()
EpisodeAction getEpisodeAction()
}
class EpisodeActionPostRequest {
<> EpisodeActionPostRequest(List episodeActionPosts)
List getEpisodeActionPosts()
}
class EpisodeActionGetResponse {
<> EpisodeActionGetResponse(List episodeActionPosts)
List getEpisodeActionPosts()
long getTimestamp()
}
}
}
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()
}
}
}
package model <> {
class Subscription {
<> Subscription(String url, String title)
int getID()
String getURL()
long getLastActionTimestamp()
String getTitle()
}
class SubscriptionAction {
<> SubscriptionAction(int userID, int subscriptionID)
int getID()
int getUserID()
int getSubscriptionID()
long getTimestamp()
boolean getAdded()
}
class Episode {
<> Episode(int subscriptionID, int id, String url, String title, String thumbnailURL, int total)
int getSubscriptionID()
int getID()
int getGUID()
String getURL()
String getTitle()
int getTotal()
}
enum Action {
Download
Play
Delete
New
Flattr
String getJsonProperty()
}
class EpisodeAction {
<> EpisodeAction(Action action, LocalDateTime timestamp, int started, int position)
int getEpisodeID()
Action getAction()
long getTimestamp()
int getStarted()
int getPosition()
void setEpisodeID()
EpisodeActionPost getEpisodeActionPost(String podcastURL, String episodeURL)
}
interface UserDetails {
String getUsername()
String getPassword()
Collection getAuthorities()
boolean isAccountExpired()
boolean isAccountLocked()
boolean isCredentialsNonExpired()
boolean isEnabled()
}
note left
Aus org.springframework.security.core.userdetails.
Wird für die Schnittstelle UserDetailsManager benötigt.
Stellt wichtige Informationen eines Users bereit.
Diese werden nur indirekt von Spring Security
benutzt, indem sie vorher in Authentication Objekten
gekapselt werden.
end note
class User {
--
<> User(String username, String password)
int getID()
String getSessionToken()
boolean getEmailIsValidated()
.. interface methods ..
String getUsername()
String getPassword()
Collection getAuthorities()
boolean isAccountExpired()
boolean isAccountLocked()
boolean isCredentialsNonExpired()
boolean isEnabled()
}
interface GrantedAuthority {
String getAuthority()
}
note right
Aus org.springframework.security.core.
Wird für die Schnittstelle UserDetails benötigt.
Repräsentiert eine Autorisierung, die einem
Authentication Objekt gewährt wird.
end note
class Authority {
<> Authority()
String getAuthority()
}
}
package util <> {
class RSSParser {
<> RSSParser(String subscriptionURL)
String getSubscriptionTitle()
List getEpisodes()
Episode getEpisodeForURL(String episodeURL)
}
note bottom
Verwendet intern Spring um
HTTP-Anfragen zu erstellen.
end note
class CleanCronJob {
<> CleanCronJob(JdbcUserDetailsManager jdbcUserDetailsManager)
void cleanInvalidUsers()
}
note bottom
Hintergrundservice, der in periodischen Abständen
Nutzer, die ihre E-Mail-Adresse nicht nach 24 Stunden
bestätigt haben, wieder aus der Datenbank löscht.
(Auf die Assoziation zu JdbcUserDetailsManager wird
im Sinne der Übersichtlichkeit verzichtet.)
end note
class ResponseEntity {
<> ResponseEntity(T body, HttpStatusCode status)
T getBody()
HttpStatusCode getStatusCode()
}
note bottom
Aus org.springframework.http.
Erweitert die Klasse HttpEntity, welche
ein HTTP Anfrage- oder Antwort-Objekt
repräsentiert, durch einen HttpStatusCode.
Wird von den Controller-Methoden als
Rückgabewert verwendet.
end note
}
class SecurityConfigurationBasicAuth {
<> SecurityConfigurationBasicAuth()
PasswordEncoder encoder()
UserDetailsManager userDetailsService()
SecuryFilterChain fiterChain(HTTPSecurity http) throws Excpetion
}
note top
Erstellt einen Servlet Filter (springSecurityFilterChain)
der für die gesamte Sicherheit zuständig ist (Schutz der URLs,
Validierung von Anmeldedaten, Weiterleitung zur Anmeldung, etc.).
end note
class PSEApplication {
<> PSEApplication()
void main(String[] args)
}
database Datenbank
Datenbank <-[hidden]d- subscriptionsAPI
Datenbank <-[hidden]d- episodeActionsAPI
Datenbank <-[hidden]d- authenticationAPI
() SQL as SQLSub
() SQL as SQLAuth
() SQL as SQLEpisode
Datenbank -- SQLSub
Datenbank -- SQLAuth
Datenbank -- SQLEpisode
SubscriptionController ..o PSEApplication
AuthenticationController ..o PSEApplication
EpisodeActionController ..o PSEApplication
SecurityConfigurationBasicAuth ..o PSEApplication
PSEApplication --() HTTP
SQLSub )-- SubscriptionDataAccessService: JPA
' SQLAuth )-- AuthenticationDataAccessService: JPA
SQLAuth )-- JdbcUserDetailsManager: JDBC
SQLEpisode )-- EpisodeActionDataAccessService: JPA
Subscription <. SubscriptionAction: ID
' Subscription <.. SubscriptionDataAccessService: DB
' SubscriptionAction <.. SubscriptionDataAccessService: DB
SubscriptionService --o SubscriptionController
SubscriptionDao <.. SubscriptionService: <