I am new to loopback, I am trying to change the accessToken table stored in MySQL. I have myUser table and the myUser model is extended from User model and if i login through myUser the accessToken is storing in accessToken table, I want to change the accesToken table to myAccessToken Table, Is is possible to change the destination of accessToken data to any other table.
can anybody help me to fix this issue
thanks in advance
In your server.js:
app.use(loopback.token({
model: app.models.myAccessToken
}))
Related
i have a django application that carries authentication by requesting a token through MSAL. once i have that token, i will check if that username exists the the local django sqlite db and if it exists, he will be logged into the website. if the username doesnt exist, then the username will be recorded in the sqlite db and the user just need to enter his credentials again for authentication and will be logged in.
what i would like to do is to replace the sqlite db with a snowflake table, which should only have a username and email column. how can i go about doing it? i am thinking that i need to write a custom user class and specifying the correct table in the class meta, switch the database in settings.py to the correct snowflake database (should be possible with https://pypi.org/project/django-snowflake/). is there anything else needed?
In my Django project I need two type of users:
- users authenticated with login/password (django.contrib.auth.models.User)
- users authenticated with token (Django REST Framework)
What's more I wish I could keep both of them in one table and display only "User" page in admin panel.
What would you suggest will be the best solution?
The token from DRF doesn't create a new User table it just creates a Token table with a one-to-one relationship with the existing User table, so you'll always have a single table (admin page) "User"
You decide what users should have a Token. for example:
# create API Token
regular_user = User.objects.create_user(....)
api_user = User.objects.create_user(...)
Token.objects.create(user=api_user)
now regular_user can only access using login/password (since he doesn't have a Token) and api_user can do both
Hope this helps
Is there a unique value for sitecore users rather than username and email address, I am trying to find an Id for the user using sitecore API but I can't find any?
Sitecore security uses the standard ASP.NET Membership provider under the hood. So you can get the Sitecore user, and then use the username to get the MembershipUser. The MembershipUser.ProviderUserKey is the Guid from the aspnet_User and aspnet_Membership tables.
var user = Sitecore.Context.User;
var membershipUser = System.Web.Security.Membership.GetUser(user.Name);
var userId = membershipUser.ProviderUserKey;
I have a login form. Also I have a huge database. One of the tables in DB is 'zusers', where stores information about users: username, password, 'telefon' and some other columns. I learned about user = auth.authenticate(username = 'John', password = 'pass'). And the question: wheredoes this function check if such user exists or no? And how to do it so that this function check for users in my DB table 'zusers'?
You will need to create a custom authentication backend in Django for your exisiting users. You can read more at the Django Docs: https://docs.djangoproject.com/en/dev/topics/auth/customizing/
You should not need to manual check auth.authenticate but just swap out the backend.
You can also substitute a completely customised model for your Django user to support telefon and the other columns you have https://docs.djangoproject.com/en/dev/howto/custom-model-fields/
I am not going to post any example code as you haven't provided any yourself and the Django links above very clearly show you how to achieve this.
I need to reset the admin password in a Sitecore 5.3 installation - any ideas how i can do this? Currently i have no access to the backend, as the password has been changed, but no one remembers to what.
There is no info in the security db that can not be overwritten, so any options are open. I have direct access to the database (SQL).
I don't have an instance of 5.3 running so I don't know if this will fully work for 5.3 but here's my suggestion.
One thing you could try is copying the values of the Passowrd and PasswordSalt field of the aspnet_Membership table in the Core database for a user whose password you know and pasting those values into the respective fields for the admin user.
The aspnet_Membership table stores only the ID of the admin user. To get the ID of your admin user you need to query the aspnet_Users table for username admin. Get the ID of the admin user in the aspnet_Users table, then query the aspnet_Membership table for that ID, update the Password and PasswordSalt fields with the values from another user whose password you know and try logging in again with that user's password.
To reset the 'admin' password and change it to 'b'. It is very simple just execute the provided SQL script on the core database:
UPDATE [aspnet_Membership] SET Password='qOvF8m8F2IcWMvfOBjJYHmfLABc='
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')
WARNING (Sitecore 6.x)!
After executing following script (thanks to Harsh Baid)
UPDATE [aspnet_Membership] SET Password='qOvF8m8F2IcWMvfOBjJYHmfLABc='
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')
don't forget to execute the similar script for salt:
UPDATE [aspnet_Membership] SET PasswordSalt='OM5gu45RQuJ76itRvkSPFw=='
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')
And for user approve
UPDATE [aspnet_Membership] SET IsApproved=1
WHERE UserId IN (SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin')