1

I'm making an UML class diagram representing classes used for authentication.

There are 3 classes:

  • X509AuthenticationFilter
  • ProviderManager
  • X509AuthenticationProvider

The X509AuthenticationFilter HAS a ProviderManager.

The ProviderManager HAS a List<AuthenticationProvider>

And in this list that the manager has there's the X509AuthenticationProvider alongside with other AuthenticationProvider's

My question is about how to display such a relation between the ProviderManager and the X509AuthenticationProvider?

The best I could come up with is just a simple association like below:

enter image description here

But I still do have second thoughts... Maybe there's a standard for displaying such a relationship?

2
  • So X509AuthenticationProvider inherits from AuthenticationProvider?
    – Doc Brown
    Feb 11, 2022 at 11:41
  • Yes, it does I omitted interfaces for simplicity
    – Joe D
    Feb 11, 2022 at 12:05

2 Answers 2

1

Indeed, a simple association seems the best way to represent this relationship. You may consider indicating a * multiplicity.

What about the alternatives ?

  • It seems that UML composition (black diamond) is not suitable, considering that composition implies responsibility for the lifecycle of the components, whereas your constructor suggest that the list and its elements could be used somewhere else. (btw, you’d consider adding a « Create » before your constructor)

  • You could consider shared aggregation (white diamond), but I would not advise it: although very popular for expressing a “HAS A” relationship, the UML specification leave its semantic unspecified, and the UML founders called it a “modeling placebo”. It has no advantage to use it over a simple association, unless you work in the context of a team that defined a context-specific semantic.

If you’re in UML hardcore you could consider using the dot notation at the end of the arrow, in addition to your current notation.

2
  • Hello, thanks a million for the answer! So, should I just add an asterisk to the arrow pointing from ProviderManager to X509AuthenticationFilter?
    – Joe D
    Feb 12, 2022 at 22:33
  • @JoeD an asterix on the side of the arrowhead that points from ProviderManager to X509AuthenticationProvider
    – Christophe
    Feb 13, 2022 at 0:13
2

For more completeness, and since AuthenticationProvider is the Base, you may consider

  • an association with multiplicity (*) from ProviderManager to AuthenticationProvider
  • Show a derived relation between AuthenticationProvider and X509AuthenticationProvider
  • Show a direct association from ProviderManager to X509AuthenticationProvider

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.