So I have been working with loopback 3 for a while, and I have seen in the user model that it contains the property realm.
So far I haven't found any information about what a realm is. I know It's mostly used in subjects like partitioning, but I have no clue what realm is about.
Are realms used to partition data based on for example company.
Like you have 2 users:
A: {
username: "Mike",
email: "mike1234@hotmail.com",
realm: "Google",
companyId: "12345e"
}
Company A: {
name: "Google",
adres: "1600 Amphitheatre Parkway, Mountain View, CA, US, 94043",
id: "12345e"
}
B: {
username: "John",
email: "john5678@hotmail.com",
realm: "Microsoft",
companyId: "56186f"
}
Company B: {
name: "Microsoft",
adres: "1065 La Avenida, Mountain View, CA, USA, 94043",
id: "56186f"
}
When a user logs in will it then only see data of that company, or what does realm do exactly?
Yes, realm is used to partition users and their data.
For example, say you are implementing QuickBooks Online system, which has a single login endpoint and presumably a single 'User' table, but when a user logs in, he or she is logging into his or her own 'Company' dataset. To limit users to their own data in a hosted application, one approach is to dress the user and all their entities with a 'realm' property. QuickBooks is hosting data for 1000s of companies, and might have multiple users per company and those users might have differing permission levels within their own company.
Similarly you essentially have realms in Microsoft Azure or Amazon AWS. Basically whenever you have a web application that has more than 1 'tenant' meaning more than one data fiefdom, you use realms.