Looking for a way to get HTTP Digest Authentication headers from incoming http requests - cakephp

I've been working on a REST implementation with my existing Cake install, and it's looking great except that I want to use HTTP Digest Authentication for all requests (Basic Auth won't cut it). So great, I'll generate a header in the client app (which is not cake) and send it to my cake install. Only problem is, I can't find a method for extracting that Digest from the request...
I've looked through the Cake API for something that I can use to get the Digest Header. You'd think that Request Handler would be able to grab it, but I can't find anything resembling that.
There must be another method of getting the digest that I am overlooking?
In the meantime I'm writing my own regex to parse it out of the Request... once I'm done I'll post it here so no one has to waste as much time as I did hunting for it.

Figured it out. It's already accessible via PHP as $_SERVER['PHP_AUTH_DIGEST']
So then you pass to parseDigestAuthData($_SERVER['PHP_AUTH_DIGEST']);
<bangs head against wall>

Related

AngularJS $http.delete and $http.put don't work in real life [duplicate]

I am trying to implement a REST protocol and have realized in trying to debug that my web server is disallowing the PUT request.
I have tested and confirmed this further by running:
curl -X PUT http://www.mywebserver.com/testpage
Which for my web server gives back a 403 - Forbidden error.
The same happens for DELETE, where as for POST and GET everything is fine.
I am wondering if this is a common issue that those who use REST encounter and what the work-around might be?
Could I make a simple change to an .htaccess file? Or do I need to modify the protocol to set a hidden variable "_method" in the POST query string?
Often web servers will be configured to block anything except GET and POST since
99% of the time they're all that are needed and there have been problems in the
past with applications assuming the requests were one of those two.
You don't say which server it is but, for example, you can tell Apache which
methods to allow with the directive:
eg:
<Limit POST PUT DELETE>
Require valid-user
</Limit>
It sounds like maybe some helpful sysadmin has used this to block non GET/POST
You could try an .htaccess with
<Limit GET POST PUT DELETE>
Allow from all
</Limit>
(I'm not an expert at apache, this may not be exactly correct)

Integrate Payment Gateway with IONIC

Don't mark question as duplicate or already asked. If know please answer.
I am trying to integrate payumoney payment gateway in my hybrid app. I went through some tutorials and finally reached to plugin cordovaInAppBrowser and using its events, loadstart, loadstop but not able to send and get parameters.Since last One Week I stucked and so finally posting here. Thanks, in advance
Finally I succeed in integrating the payment gateway in ionic. Its very easy, jsut follow the following steps,
add the cordovaInAppBrowser plugin and Inject the dependency.
make all the fields you get that to send to that Gateway with all validations.
now you needed some 3 files as success.php, failure.php and paymentfile.html.
$cordovaInAppBrowser.open("filename?"+params, '_blank',options)
make note that success and faliure php file are in server and access them through server
get the response in the php file than to controller, based on the response traverse the path and its done.
Most important you need to serialize the data while sending as its should be global and assign it to window object.
Also we have to use the cordovaInAppBrowser events loadstop() and all the stuff i had done in this event and later i call the close() function when its done.
Its Done.

Exceeding API request limit

I'm using an API data feed for the first time, and it has a request limit of 1000 per hour. This seemed like a lot and I didn't expect to ever exceed it, but just in testing the site I have.
Could this be anything to do with how it is being requested?
It is an Angular application, which uses a Service to call the API endpoint, but the specific endpoint is dictated by a 'team_id' property which exists in an object that is selected on the 'parent' page. I've used $routeParams to pull out that variable and then populate the request URL with that included.
Is this a clumsy way of doing this that is causing 'phantom' requests to occur? As I said I have no idea how the limit was exceeded so is anything else that could be happening here to cause unnecessary API requests in the background?
Thanks in advance.
It's going to be tough to troubleshoot unless you post your code that is doing the actual API requests. If you have any loops happening, intervals, or ajax, that could easily multiply your requests into the hundreds on every page view.
Your best bet to troubleshoot is to look at your browser debugger and just look at the http requests in the 'network' tab of your browser dev tools. It will list each individual request for you as they happen (if they are done as an http request / AJAX).
https://developer.chrome.com/devtools
https://developer.mozilla.org/en-US/docs/Tools
https://msdn.microsoft.com/en-us/library/dd565628(v=vs.85).aspx

One autherization method call for all users

I have a problem with setting up specific scnario in gatling.
I want to call my api to get authorization cookie, and then start the main scenario. I want to authorize only once, save the response, and then, for example, run test for 500 users for 30 minutes using the same auth cookie.
Is it possible to set up it like this? I'm not sure if it is possible using before hook.
I was searching for answer to this question, but I've found nothing. It would be great if I get some advices
I'm not sure if anybody needs answer to this question besides me, but I'll post what I had to do, to achieve my goal :)
I simply made post to authentication method before the scenario. I used scalaj-http library.
I saved a response in a varable and after this request was completed I run my scenario with passed variable

angularjs ngfacebook batch request

Can anyone who knows how to use the angularjs ngFacebook module help me to perform a facebook batch request? Is it possible to do it with this module?
What I need exactly is to get the user events from facebook, for that I have to do 4 different request:
$facebook.api('/me/events/attending').then(function(response) {//code here});
$facebook.api('/me/events/created').then(function(response) {//code here});
$facebook.api('/me/events/maybe').then(function(response) {//code here});
I think I could batch this request, I just don't know if it's possible to do using this module.
Also the most tricky part would be that, for each event returned I would need to get the owner, and with the owner.id to get his picture, right now what I do is:
$facebook.api('/me/events/attending?fields=owner').then(function(response) {
//And here I do a "for" into the events to request for each owner picture
});
Of course it doesn't seem the best way to do it, but I have searched a lot for the solution and I couldn't make anything work.
I think you should be able to request all user events, inluding the owner info:
GET /me/events?fields=id,name,owner{id,picture},rsvp_status
You can determine the "status" of the event to the user by the rsvp_status (attending, maybe, declined, no_reply) field.
See
https://developers.facebook.com/docs/graph-api/reference/v2.3/event#read
https://developers.facebook.com/docs/graph-api/reference/user/events/
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#fieldexpansion
I'm not sure of the batch request protocol that Facebook uses but you could try this module.
https://github.com/jonsamwell/angular-http-batcher
If it doesn't support it add an issue and I'll looking into implementing it. Disclosure: I created this angular http batching library.

Resources