aws sdk nodejs: check if there is any users online - node.js

Is there a way to find out which user is still online? I read somewhere that I cannot do that directly, but use the sessions to check either anyone is online. If it possible to get user sessions without having to know user credentials?
Or is that is an alternative way that i can do to get find out which users are still online?

Related

How could I secure this API?

I'm building a full-stack application with Next-JS. I'm building an API that works with Firebase. I was wondering if there is a way to make this API secure.
Let me elaborate. There is an option to your account called Premium. This variable is stored in the Firestore and will determine if you have purchased a Premium membership. This will determine whether or not you have access to certain features. I will use an API to change this variable.
I had the following in mind:
Have a button on the page to upgrade account.
Button pressed? Call to the API with the following params: email, upgrade to. This is because the same function can also be used to downgrade an account, for example when the user doesn't pay for the upgrade.
That API function changes the variable in the Firestore. It returns a status and a message.
I want to make option 2 more secure because otherwise, it would allow anyone to change the premium variable. That is obviously not what I want. Is there anything I can do about that? For example, a token system, the thing with that is that I have been thinking about that and I don't really know how to implement that and how it would work exactly.
For anyone wondering why I am using an API: I will also be creating an app, probably with react-native. The user will also be able to change their account status and interact with the API to do other stuff in that app.
Thanks for reading and responding! I hope this is at least a bit clear. If you have any questions, please comment them.
I do similar things in my app. I use Cloud Functions (which operate in a secure environment) to both save settings in Security-Rules -protected tables, as well as setting Custom Claims in the users Auth profile. All authorizations are then verified in the Cloud Functions before any changes are made - You may need to "seed" some values in a protected collection/document from the Console to get the process started.

Create user in Active Directory using node.js

I need to create a user in Active Directory with node.js. I found this library, but this seems to only get information out of AD and is not able to create Objects, e.g. a user.
I have never worked with AD before and have less to no knowledge about it. May someone help me how I can realize this with node.js (TypeScript)?
You can do this with the Graph REST API https://learn.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http
This needs an auth token to use the API above which you can get using this one https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/sample/client-credentials-sample.js

Windows Store 8.1 App Azure ADAL offline client authetication

I'm building a Windows 8.1 store app and need to incorporate authentication. This is an enterprise app used in house. We load the app onto a tablet and a team may check that tablet out for weeks at a time, go out to the field to collect data and then we put in on a shelf until another team needs to use it. Now different teams may work for difference clients so when we authenticate users not only do they get access to the app but we also check what groups they are in to determine what clients they can work on or what previous records they can search for.
I've followed various ADAL tutorials and am able to setup everything in Azure and in my app I am able to authenticate a user successfully and get their groups. This relies on ADAL handling the username/password. What happens when the app shuts down and the user in a place where there is no internet (or even a reliable cell connection)? Specifically how can I have the user type a username/password to re-authenticate and get the same groups they were in when they can't access Azure services?
It appears they isn't available as the guidance always points to that is a risky proposition to have the app handle username/passwords. I understand that stance and can appreciate the caution behind it. However, in all of the ADAL documentation that I find that says this, none of them tell me how to handle an offline authentication scenario.
I have found links such as ADAL v3: How to authenticate using UserPasswordCredential? that tell me how to bypass the ADAL login page. I may have to move to that route and handle all of the username/passwords securely within the app, but first I would like to reach out and see how others tackle this scenario. Is it really as simple as avoiding best practices and just handle the username/password within the app?
If anyone has some guidance, ADAL (or other oauth providers) documentation, or other articles/advice I can follow up on to help achieve offline authentication I would greatly appreciate it!
Additional Information:
My scenario that I'm trying to cover is what happens when I have 1 device, 1 app, and many different users? These users will be in different groups that will determine how data fields get populated (filter data in combo boxes) and what previously submitted forms they can query for. All users would need to login when online to cache their information (say on Day 0) before they can ever use the app. On Day 1 user 1 uses the app and doesn't log out. I would expect the app to have a timeout timer to log that user out after 2 hours of no activity. On Day 2, user 2 just grabs the device off the shelf and takes it out into the field. He has no internet and needs to log in to determine who they are and what group they are in. I would expect since he has logged in once and verified his credentials already that we can enable this sort of scenario.
What I'm looking for is guidance if ADAL as a library can handle this or is it truly up to me the app developer to handle this sort of scenario. As I see it currently I need to store all user credentials, but at the same time it seems like everyone advises against that. I feel like I'm in a situation where I need to create a custom login screen and store the user data, SECURELY of course, even though its not recommended. It seems like all articles on how to use ADAL are written from a consumer app standpoint (or a BYOD) and don't take into account how a mobile app would be written for the enterprise.
That depends on your app design, if the first time(app online) , user login and app store all groups ,user information .After that user doesn't need to use token to get related information again(send request to server to acquire groups/user info). If app is offline , user doesn't need to re-authenticate(app controls the user session) , just get group/user information from cache . When using resource owner flow , you still need to send authenticate request to Azure AD server which need internet.

auto login google docs

Situation:
Users can access their google docs by an external link on a website. Now they first have to login to view their documents.
Problem:
I want that the users automaticly login on Google Docs
I've the username and password stored in a dabasase..
What is the best way to solve this problem?
There is no good way to solve this. You could fake a login programmatically, but that would work only to fetch a document, not to really log in the client. Plus it's really not a good idea to have a database with peoples' Google logins lying around, especially seeing as the passwords have to be unencrypted.
I would leave it up to the user to store their Google password in the local browser.

Sharepoint SSO bulk creation of user accounts

Hopefully someone can help...
I need to provide client with a solution to allow bulk creation of user accounts into SharePoint SSO. The client wants to provide an excel spreadsheet with accounts, usernames and passwords and have that created in the SSO database.
I've been told its possible but I can't see how and google is failing me. I've been told its "some custom development and the SharePoint object model". As far as I can see all of the credentials stuff in the Microsoft.SharePoint.Portal.SingleSignon namespace is very much read only.
I have a solution which is to get them to save the spreadsheet as a CSV file and to use jmeter to squirt the data in through the front end. I don't think that's really an acceptable solution though.
Anyone got any clues? Or can anyone say definitively this can't be done?
Thanks in advance...
You can store the user credentials in Active directory or SQL database based on the authentication method. You can write code for copy these credential in the AD/database.

Resources