jose4j the reverse of the JSONAware - jose4j

I have used the brilliant JSONAware interface (with the method toJSONString) on jose4j so that I can add a complex JSON structure under a single claim - it generates just what I wanted the JWT to look like.
However now I'm trying to extract the same claim from the JWT, and there seems no built in way to reverse it. I was hoping for another interface (or a method on the same interface) with a method called fromJSONString or something that I could call with:
getClaimValue(String, JSONAwareImpl.class)
that then returned the class (my using the implementation of the method).
Any ideas on this? At the moment my only solution is to get the entire JWT in raw format and parse the entire thing to extract just my claim. It just seemed a little strange to be able to go one way and not back the other way, and wondered if I have just missed something?
Thanks.

Related

NetSuite 2015_2 PHP-SDK Two Factor Authentication

We currently have Two Factor Authentication working in the 2017_2 release of the NetSuite PHP Toolkit, but we have some code that has broken due to changes between 2015_2 and 2017_2. It seems that in 2017_2 it is also far easier to set up Two Factor Authentication.
Looking at the code, however I do see references to TokenPassport and TokenPassportSignature, which tells me that I should be able to get TBA working in 2015_2, which would give us time to figure out the rest of the issues.
My question is: How would I actually go about that? I have set $service->passport to the generated TokenPassport object. I know that my TokenPassport object works in 2017_2, and I assume it would be the same, but I don't know for sure, and I can't seem to find any information up on Elgoog.
ETA: I have seen examples of this working in 2015_2 in Ruby, but not in PHP. The backend is there, but I can't seem to be able to do this in PHP, and the Ruby examples were only snippets.
Okay, so I solved this for myself, but I may not have done it the "right" way. Here's what I did:
I took the makeSoapCall and setTokenGenerator methods from the new instance of NSPHPClient.php, and I added them to the OLD version. I had to modify the setTokenGenerator method to not require an instance of iTokenPassportGenerator, but I could have just as easily copied over that interface as well.
Basically, all that needs to happen is that we need to send the tokenPassport header, which the older version of the SDK can generate but doesn't have a method to actually send that I could find.

How to test a rdfa parser?

I'm trying to find a way to check if my rdfa-parser (written in nodejs) is working.
So I have an rdfa-parser, which should print all triples, found in a file or url (with rdfa-syntax).
So far I know, that there are testsuits for RDFa-parsing (http://rdfa.info/test-suite/rdfa1.1/html5/manifest), but I'm not sure how to use them.
Is there a good webpage, where this is described? Or can anyone help me in another way?
There should be some information at the rdfa.info/tests site. Basically, you need a service that will accept a GET request, where the "uri" query parameter points to the input file. The service then parses the file, and returns some other form of RDF, typically N-Triples. More information on the Github page: https://github.com/rdfa/rdfa-website/blob/master/README.md

Liferay Structure Predefined Value

Which table in Liferay stores the predefined values given for a structure.
Also is there a facility in Liferay to populate these values dynamically using webservices?
The API used to be JournalStructureService, however, as the documentation states, this has been replaced with the Dynamic Data Display API, which, for example, you can find under DDMStructureService in version 6.2.
This gives you a hint where to find the underlying data, however, you don't want to manually write to the database. You do want to use the API to change values. Trust me. Consider the database to be an implementation detail and leave it alone - if nothing else to make your next upgrade experience easier. You should never change any values in the database manually without knowing exactly what you're doing. And, trust me, the keyword here is "exactly", and you'll fail to know all the possible side effects. Don't touch it.
As said #Olaf, depends on Liferay version you will need to use the JournalStructureService or the DDMStructureService. So, if you want to use the Liferay Service by web api you have two options the Axis api where you can obtain WSDL (domain:port/api/axis) or you can use the Json api (domain:port/api/axis). In many cases you are going to need a token to use this services.

ServiceStack Razor - How to Return Validation Errors to a Form?

I'm trying to figure out if it is possible to use ServiceStack Razor for old-fashioned server-side form validation.
By way of example: a GET to a url returns a razor template with a form. When the user POSTs the form, request DTO is validated and if there were errors, the user is shown the same form, with original values re-populated as and fields in error marked somehow. If, on the other hand the request DTO is valid, the service will redirect the user to another page.
Is that scenario possible?
If so, how would one go about implementing it? I presume I'll have to write certain filters or features for this to work, however I'm wondering what strategy will require minimum amount of coding.
(I understand javascript validation is possible, however my question is specifically whether it is possible to round-trip the form with server-side validation).
Take a look at ss-validation.js, it can be used to apply validation errors to your form based on ServiceStack's ResponseStatus.
So we write all our validation code server side using FluentValidation, then on round trip ss-validation reads ResponseStatus and applies markup.
Out of the box is assumes Bootstrap style validation, but it's fairly easy to modify to suit your needs, e.g. we amended to display inline icon tool tips instead of inline/block messages, and provide an error summary.
After a lot of spelunking of the ServiceStack codebase, it seems it is theoretically possible to achieve the desired scenario.
The code already contains ModelMetadata and ModelMetadataProviders classes, and some of the HTML helpers are ported from System.Web.Mvc.
Sadly, the classes are not fully wired, so I guess it will require solid amount of work to get everything working correctly as one would expect.

Suggest list in google maps search input

We need to create search input field like it is on _http://maps.google.com
The key functionality is suggest list with appropriate results. We
have not found this feature in API.
Analyzing maps.google.com we see that suggest list is received
from get request to this url
https://maps-api-ssl.google.com/maps/suggest?q=%D0%BC%D0%BE%D1%81&cp=...
There are many parameters, including data from search field. This get
request returns our suggest list.
Is there a possibility to use this url in our needs with our data. Or
how can we make it in some other way.
Similar to our needs: _http://cdn.michaelhart.me/mh/instant/maps/
check this out:
http://tech.cibul.net/geocode-with-google-maps-api-v3/
Theoretically you shouldn't use maps-api-ssl.google.com/maps/suggest as it might not be legal. I found this quote from google employee:
'Endpoints like this that are used by Google Maps but not documented as
part of the Maps API should be considered private interfaces.
Consequently use of those end points is a breach of the Terms of
Service. In addition any existing API credentials you may have are
completely unrelated to these end points because they are not served
by API infrastructure'

Resources