What's the best unique identificator in pop3 with imap functions in php? - pop3

I have a question, What's the best unique identificator in imap with php? look, i'm working with a pop3 account, but the host deletes emails, every week automatically, so, they restart the uid and they turn it to 1. That's a problem, because I copy the Imap mails to MySQL database and when i update the database I have with UNIQUE attribute the field named uid, and it doesn't updates. I don't know if the best unique identificator is message_id.

In IMAP, on a properly implemented server, the full unique ID for a message is based on a tuple made up of the (folder name, UIDVALIDITY, message UID). If the folder is recreated, it should have a new UIDVALIDITY.

Related

Can I use the userSub in AWS Cognito as primary key?

I am looking to use the data that comes with Cognito as secondary key to connect to other database.Potentially, I could use username or email. However, according to the project requirement, there will be lots of concerns of using sensitive data as primary key for other database. I am looking for an alternative way to set the unique key. Wonder whether userSub can be used as unique key for each users? Or there's any other values that I can use?
When a user is created in Cognito user pools, Cognito generates a sub for each user which is unique throughout the user pool. As such, you can use the sub field as a unique identifier for your users.
Though now considering that you are using usernames for your user, the username needs to be unique and so you can use the username as well instead of the sub.
If the user pool is configured to use email as username - in this case the email needs to be unique for all the users, meaning that there can not be any duplicated email id.
Same goes for phone number if a phone number is configured to be used as username.
So, in the end it is your choice is you want to use sub as a unique identifier in your key or the username.
Im my opinion I would not use an email address as a key.
How would this affect the system if the user decided to change the email address in the future or for some reason the email address simply becomes obsolete.
The sub I think would be a decent choice to use as a key. However, whenever I am thinking about primary keys I'm always thinking a million years in the future.
Ultimately I would choose a key that will forever be unique throughout the org eliminating the possibility of any future conflicts or in your case, confidentiality issues.

Can we add a claim in WSO2 Identity Server to have a unique value?

I have a user profile which is identified in WSO2 Identity Server by it's unique username and unique contact id. WSO2 already supports unique usernames but I also want to ensure that we won't have any duplicate contact ids assigned.
Is there a way that we can support uniqueness for claims other than the username?
There is no out of the box way to do this AFAIK via a configuration.
An alternate approach I can think of is to write a user operation listener that gets triggered during a profile update and can validate whether the updated unique contact id is valid.
Refer http://www.securityinternal.com/2016/08/writing-user-operation-event-listener.html to get an understanding on how to write one.

Redis, expiring array items

I'm trying to use Redis for preventing excessive access to a website, here's a plan, I'd have an array of data
IP => (0 => http://, 1 => http://)
However what I need to do is to set an EXPIRE tag for each one of those items, i've looked into sets, hashes and many other, however I can't seem to find a way. I was told by server support that it's possible but i'm way too new to redis.
I've found the following example on their website
RPUSH pagewviews.user:<userid> http://.....
EXPIRE pagewviews.user:<userid> 60
However i'd need to know the key, which I can't seem to get or find a way to get. I'm using predis to work with redis. Any help would be appreciated!
The userid comes from your app, not from Redis. It can be:
a logical, unique user name (if users authenticate on your site)
some sort of unique ID assigned to every user and persisted in a cookie (disadvantage: users can delete cookies)
a client IP address (disadvantage: multiple users might use the same IP address from a variety of reasons).

Redis newbie - equivalent approach to mysql table

I'm new to Redis and was hoping for a "best practice" solution to implementing the equivalent of a "users" table in a mysql database, for handling users in a web app.
Would I create a users SET in Redis? Or a users database with a SET for each user?
My standard setup for users is a serialized object in a standard key u:userid - this object gets retrieved on each request, and there is never any need to access only one of the properties.
You could also use a hash rather than json for the user properties, but my setup includes everything getting used as strongly typed objects and redis running on a different server from the client, so using json makes it easier to use generic deserialization and minimizes any latency issues.
In addition to the user object itself, you will need an index for any fields you need to use to find a user - for example to allow a user to log in with email address you will need a key e:email => userid. A hash will also work here - the important thing is that you need something that is O(1) to get from an email to a user object.
Sometimes parts of the user data should have their own keys - for example a followers list is a perfect match to a redis set, so is best stored in that form.
It really depends on what you'd want to do with the Users within your application. Another option would be to have each user be it's own hash, where they keys are properties (fields) for each user (firstName, lastName, etc). You could use a key that you increment as the ID generator for inserting, and potentially another set that you use to hold all of the user IDs.

Lotus Notes, ID files, and how things are changing in new versions (8 and up)

For those who are not aware, Lotus Notes is a cool system, which has very powerful database replication abilities, and very strong certificate management and signing.
However that strong certificate usage is itself one of Notes's downfalls.
When you log in to Lotus Notes via a Notes client, the password you use is not stored anywhere, except as the encrypt/decrypt key to the Private Key stored in the Notes ID file on your local workstation.
What this means is that you can have 15 copies of this file, with 15 different passwords, and each one is valid, as long as you have the matching password.
For Identity Management systems, this is pretty crippling, as there is no server side component to access the password change event, rather it is entirely client based, and the server can barely even tell it happened!
The rumours I hear is that in later releases of Lotus Notes/Domino, this ID file based authentication is starting to change.
I am having trouble finding clear cut explanations for what is changing, how, and in what version. (8.5? 9? Later?)
Second part to this question is, what is happening in terms of Active Directory integration? I heard it rumoured that AD authentication might be allowed instead of ID file authentication. My guess on that aspect is that the ID file stored on the server will still be used for authorization, but the successful Active Directory authentication will be used to unlock access to it? Or is it some other model?
Looking for someones perspective who has figured this out already!
On a side note, there is a second password (httpPassword) that is used when Notes's Webmail is accessed, since of course the server has no access to the local ID file when the user authenticates. One assumes this is the model they would move to for other forms of authentication, but as we all know, assuming is a bad plan!
Notes Domino 8.5 has the new ID Vault feature. It was released in early January.
ID Vault works by keeping a copy of the id securely on the server. It then provisions the id on demand to the user. This allows for a configuration where the user asks the server to reset the password and the server makes the change to the id file before downloading it the the user.
More info on ID Vault here:
A New Way to Manage Notes User IDs and Passwords (dominoblog.com)
Sneak peak - the Domino 8.5 id vault (pmooney.net)
Updated: 8.5 has been released.