Replies: 1 comment 2 replies
-
Thanks for opening a discussion! I'm not too familiar on the reasoning behind the design choices, but for what it's worth, here's what I found:
If I were to guess, this design seems to have either...
From what I can observe, the following changes should be made:
Also considering that there can be multiple
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First a quick description of my project.
Its a cloud service to provide MQTT servers for IoT gardening devices and client apps (that are also part of the project) to transparently connect to.
The user doesn't handle the MQTT connection (hostname:port + username:password). That data is provided by an API endpoint called 'check-in'.
User
workflow:User
is createdUserProfile
payload)So far so good. I could implement that using what I've learned from the authentication + authentication-jwt docs.
But things get unclear to me when we introduce the device workflow. It also needs access to the check-in endpoint:
Device
is created, device receives its own credentialUserProfile
payload??)It seems to me that the device is another type of Principal that need authentication: exchange its
own credential for an access token. And that token must be decoded back to the device, not to a user.
What is unclear to me is that even though the security package exports the base Principal interface
(as well as a set of specialized interfaces, one of which is UserProfile), the
authentication
package is hard-coded to use
UserProfile
all over.The class
TypedPrincipal
(@loopback/security
) seems the perfect candidate for what I need, butits not mentioned anywhere.
For the sake of completeness, there is another entity (called
App
) in the project that also (as of my current understanding) represent a type of Principal.App
s represent extra services that a customer can opt-in: there is a service to persist device log to a log database and another service to persist sensor data to a metrics database. Both services collect data by connecting to each customer's server.Those services are implemented as separate applications, and do not have access to the API database. They are API consumers and also need access to the "check-in" endpoint to retrieve the list of servers they must connect to.
Any help is welcome. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions