I have created a URL that consist of some parameter like client id , expiry date and so on. Among these parameters I have one parameter called "Signature" which is hmac encrypted to maintain the security. Now the final URL getting generated is of length greater than the column length in which it is supposed tobe stored. Changing the length of the DB column is not a feasible solution. Now how should i shorten the URL to store it in the column?
The first approach i took was to also encryt the generated URL using HMAC encryption. But as this generated URL is to be used by a third party application and that HMAC encrypted values are impossible to be decryted to the original data . Now I am not sure how to store this URL in groovy file
Related
I would like to create a Google Calendar event with a URL having a predefined eventId, so that if user want to modify the event later I can redirect him to the Event using predefined eventId stored in database.
You can use the events.insert method as specified there: https://developers.google.com/calendar/v3/reference/events/insert
You can pass a custom Id on the requestBody of your query that you can use later, alongside your calendarId, to edit your event through the update or patch method.
Follow the guidelines when generating your custom Id:
Provided IDs must follow these rules:
characters allowed in the ID are those used in base32hex encoding, i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in
RFC2938
the length of the ID must be between 5 and 1024 characters
the ID must be unique per calendar
Due to the globally distributed nature of the system, we cannot guarantee that ID collisions will be detected at event creation time.
To minimize the risk of collisions we recommend using an established
UUID algorithm such as one described in RFC4122. -If you do not
specify an ID, it will be automatically generated by the server.
Given that I already have a guaranteed unique string, is it possible to generate a shorter version of this string while keeping the newly generated strings also unique?
The existing unique code is the id generated by firebase firestore, the ID is too long and I prefer not to use it as referral code. I was hoping to limit the length of the string around 8-10 chars.
EX of firebase id: NIzTFZUC64Voc4ttiiNsBF0GNWF3
I need a much shorter version of this string
I also don't want the codes to be case sensitive
We make use of Sign in with LinkedIn for a pre-existing app. The app uses the id field returned as part of the user's profile, however the app has restrictions on what character values can be present in the id.
What are the legal characters that LinkedIn will put in the id?
The description for id says
A unique identifying value for the member.
This value is linked to your specific application. Any attempts to use it with a different application will result in a "404 - Invalid member id" error.
Testing a small sample size, shows things like zHjkl_t-4D, _IcF7_r2b1 and -1ZM8mwCKM, which caused an issue with the field being restricted to starting with alphanumeric characters. I'd like to know the legal values so we can access if LinkedIn signups are suitable for future applications.
Member IDs are presented in Base64 encoded format. Any characters that show up in the Base64 index table are valid.
I'm looking for a fast & elegant way of converting my object IDs with descriptive names, so that my autogenerated routes look like:
/products/oak-table-25x25-3-1
instead of
/products/5bd8c59c-fc37-40c3-bf79-dd30e79b55a5
In this sample:
uid = "5bd8c59c-fc37-40c3-bf79-dd30e79b55a5"
name = "Oak table (25x25) 3/1"
I don't even know how that feature could be named, so that I might google for it.
The problem that I see so far is the uniqueness of that "url-object-name", for example if I have two oak tables 25x35 in the db, and their names differ too little to be uniquely url-named but enough to fool the unique constraint in the db.
I'm thinking of writing that function for name-transform in SQL as an UDF, then adding a calculated field that returns it, then unique-constraining that field.
Is there some more mainstream way of achieving that?
One method is that employed by stackoverflow.com which in your case would be:
/products/5bd8c59c-fc37-40c3-bf79-dd30e79b55a5/oak-table-25x25-3-1
This ensures uniqueness, however the length of the UUID may be a deterrent. You may consider adding a sequential int or bigint identity value to the products table in addition to the uniqueidentifier field. This however would require an additional index on that column for lookup, though a similar index would be required for a Url having only a descritive string. Yet another method would be to use a hash value, seeded by date for instance, which you can compose with the descriptive name. It is simpler to rely on a sequential ID value generated by a database, but if you envision use NoSQL storage mechanisms in the future you may consider using an externally generated hash value to append.
Identity should have 2 properties: it should be unique and unchangable. If you can guarantee, that /products/oak-table-25x25-3-1 will never change to /products/oak-table-25x25-3-1-1 (remember, user can have bookmarks, that shouldn't return 404 statuscode)- you can use name as url parameter and get record by this parameter.
If you can't guarantee uniqueness or want to select record more faster - use next:
/products/123/oak-table-25x25-3-1 - get record by id (123)
/products/123/blablabla - should redirect to first, because blabla no exists or have anoher id
/products/123 - should redirect to first
And try to use more short identities - remember, that at web 2.0 url is a part of UI, and UI should be friendly.
MVC routing (actions) will handle spaces and slashes in a name. It will encode them as %20, and then decode them correctly.
Thus your URL would be /products/oak%20table%2025x25-3%2F1
I have done something very similar in an eCommerce platform I am working on.
The idea is that the URL without the unique ID is better for SEO but we didn't want the unique ID to be the product name that can change often.
The solution was to implement .NET MVC "URL slug only" functionality. The product manager creates "slugs" for every product that are unique and are assigned to products. These link to the product but the product ID and name can be changed whenever.
This allows:
domain.com/oak-table-25x25-3-1
to point to:
/products/5bd8c59c-fc37-40c3-bf79-dd30e79b55a5
(The same functionality can be used on categories too so domain.com/tables can point to domain.com/category/5b38c79c-f837-42c3-bh79-dd405479b15b5)
I have documented how I did this at:
http://makit.net/post/3380143142/dotnet-slug-only-urls
I am integrating openid in my website.
I am able to retrieve data(ex email) from op provider(by query string).
But different op provider gives data in different key like gmail gives it under openid.ext1.value.alia2 key and yahoo gives it in under some different key.
how should i retrieve value from query string.
You must check namespaces. For example, the server may return openid.ns.ax = http://openid.net/srv/ax/1.0, and that would mean "everything that starts with openid.ax relates to the AX extension".
But it could be openid.ns.qwerty = http://openid.net/srv/ax/1.0 as well, and then everything that starts with openid.qwerty would be related to the extension.
Your code must read those namespaces and use aliases as defined by those. Read specifications for more information.