Swagger Support in Hippo REST API - swagger

We have followed the steps what mentioned in the below document.
https://www.onehippo.org/labs/integrating-swagger-with-hippo-cms-restful-resources.html
After configuring all steps, we are getting 404 for Rest API-DOC and couldn't move further.
URL: http://localhost:8080/site/rest/api-docs
Can someone help here to take this forward?
Logging Information:
4.08.2018 20:48:45 WARN ajp-nio-8009-exec-9 [JAXRSInInterceptor.processRequest:166] No root resource matching request path /site/rest/api-doc has been found, Relative Path: /api-doc. Please enable FINE/TRACE log level for more details.
14.08.2018 20:48:45 INFO ajp-nio-8009-exec-9 [DiagnosticReportingValve.logDiagnosticSummary:44] Diagnostic Summary:
- HstDelegateeFilterBean (22ms): {request=Request{ method='GET', scheme='https', host='localhost', requestURI='/site/rest/api-doc', queryString='null'}}

Related

ZF2 - Apigility not creating new api

I have Apigility running successfully on an app and have decided to use it for a new one. The problem I am stumped with is that it refuses to create a new api and appears to "hang" on the "create new api" screen.
Here is a screenshot of where it hangs: http://screencast.com/t/7CI3TN38Fm
Any advise on how to bug test this or has anyone experienced similar issues?
EDIT
When checking the console I note the following errors:
http://screencast.com/t/gIbZEWMwo
http://cloud.examplesite.dev/apigility/api/fs-permissions Failed to load resource: the server responded with a status of 403 (Forbidden)
vendor-angular.js:2 TypeError: Cannot read property 'fs_perms' of undefined
at http://cloud.examplesite.dev/zf-apigility-admin/js/app.js:1:5838
at j (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:16336)
at http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:17013
at k.$eval (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:21222)
at k.$digest (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:19926)
at k.$apply (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:21541)
at f (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:2732)
at r (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:4556)
at XMLHttpRequest.w.onreadystatechange (http://cloud.examplesite.dev/zf-apigility-admin/js/vendor-angular.js:2:5095)vendor-angular.js:2 (anonymous function)
http://cloud.examplesite.dev/apigility/api/cache-enabled Failed to load resource: the server responded with a status of 403 (Forbidden)
3http://cloud.examplesite.dev/apigility/api/module Failed to load resource: the server responded with a status of 403 (Forbidden)
http://cloud.examplesite.dev/apigility/ui#/api Failed to load resource: net::ERR_CACHE_MISS
vendor-angular.js:2 GET http://cloud.examplesite.dev/apigility/api/dashboard 403 (Forbidden)
vendor-angular.js:2 GET http://cloud.examplesite.dev/apigility/api/dashboard 403 (Forbidden)
EDIT
After further investigation it would appear ZfcRbac is the cause of the problem... to create the Api it needs to be commented out.
Not sure of the best method to work around this... will investigate and post the answer once I know.
What I did to resolve this was to create an autoload file: mydev.local.php and to include the following in it:
<?php
return [
'zfc_rbac' => [
'protection_policy' => \ZfcRbac\Guard\GuardInterface::POLICY_ALLOW
]
Problem solved. thanks!
];
This means that any route that is not in my guards is not protected... of course when going to live mode, the local override file is not included...
If you update Apigility to the dev-master this issue will go away.
In your composer.json use this
"require-dev":{
"zfcampus/zf-apigility-admin": "dev-master"
}
and please disable opcache in php.ini also.

does docpad secondary url redirect feature work?

Based on the documentation of docpad primary url, all requests to a document secondary url should be redirected to the primary url. But actually it respond the expected page directly when requesting any secondary urls without any redirection.
For example, you have a docpad document /src/documents/secondary-url.html.md like:
---
urls:
- '/my-secondary-urls1'
- '/my-secondary-urls2'
---
# primary url should be `secondary-url.html`
Then run command $ docpad run
It will responds status 200 when hitting either http://localhost:9778/my-secondary-urls1 or http://localhost:9778/my-secondary-urls2. While expected result is a redirect with status code 301 to http://localhost:9778/secondary-url.html
It seems an expected feature if checking this line of docpad code.
I'm curious if this is a defect or a deprecated feature?
BTW: I have a simple fix here which won't become a pull request until I read the contribution guide: https://github.com/shawnzhu/docpad/commit/731cdec43f9d9d155c8a8310494575d9746a065c
This was addressed in issue 850 of project docpad, and fixed in pull request 905, so further version than v6.70.1 of docpad will contain this fix.

Error with WSO2 API Manager OAuth Authentication

I installed the latest WS02 API Manager, 1.6.0. I followed the directions and just did the plain install, nothing special. When I create an API, publish it, subscribe to it, create an Access Token, and try to access it, I am seeing the following error (I replaced the access key, but it is displaying):
[2014-02-03 13:25:47,850] ERROR - APIAuthenticationHandler API authentication failure
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Access failure for API: /weather, version: 1 with key: access_key
It seems that the API and access key are not getting connected. Is there something else that I have to do to make that happen? I am not using a separate database for the Key Manager, just whatever comes with the install which is a memory DB I assume. I have tried this from Advanced Rest Client in Chrome. I'm guessing something's just not configured correctly, but I don't see any errors in the start-up. I just see a few warnings along these lines:
[2014-02-03 13:25:01,262] WARN - DefaultSchemaGenerator We don't support method overloading. Ignoring [validateAudience Restriction]
Here is the full stack trace for the error:
[2014-02-03 13:25:47,850] ERROR - APIAuthenticationHandler API authentication failure
org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException: Access failure for API: /weather, version: 1 with key: access_key
at org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.jav
a:139)
at org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHand
ler.java:92)
at org.apache.synapse.rest.API.process(API.java:285)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:336
)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

AccessTokenAuthorizationCodeRequestC "error":"invalid_request"

At the second call to Client.ProcessUserAuthorization(); after I get the code from the oauth server, I get an exception: Error occurred while sending a direct message or getting the response.
Here is the last part from the log file taken with log4net, the full log is recorded in this gist: https://gist.github.com/tonyeung/5513769
2013-05-03 15:14:41,292 (GMT-5) [10] DEBUG DotNetOpenAuth.Messaging.Channel - Sending AccessTokenAuthorizationCodeRequestC request.
2013-05-03 15:14:41,393 (GMT-5) [10] DEBUG DotNetOpenAuth.Http - HTTP POST http://localhost:38828/OAuth/Token
2013-05-03 15:14:41,450 (GMT-5) [10] ERROR DotNetOpenAuth.Http - http://localhost:38828/OAuth/Token returned 400 BadRequest: Bad Request
2013-05-03 15:14:41,450 (GMT-5) [10] DEBUG DotNetOpenAuth.Http - WebException from http://localhost:38828/OAuth/Token:
{"error":"invalid_request"}
I've uploaded the solution to https://github.com/tonyeung/dotnetopenauth
The entry point is in the about action on the home controller of the Client project.
The solution is in VS2012, the latest nuget dnoa package. Nuget restore is on.
Please note that I'm implementing pieces as I need them in order to understand how the library works. I'm sure that this error is due to a missing implementation somewhere, but I'm not sure what it is?
So it looks like I was missing implementations for IsAuthorizationValid and CreateAccessToken in the Authorization Server. Please check the github repository for the stubs i put in that makes the error go away.
EDIT:
There was also a database validation error that I didn't trap. So basically any error on the server side will cause this message it looks like.
EDIT2:
There was also an issue where if the url of the page contains any non url encoded values it will throw an invalid request. In my case, my login page had a querystring parameter of returnUrl, and I had set it to /Home, which it DID NOT like, had to be: %2FHome

Unauthorized Orbeon Form Error

I am using orbeon xform engine as a separate deployment with my Java Application. I followed all the steps required for separate deployment but while implementing xfroms using Orbeon I am getting following error:
"Orbeon Forms - Unauthorized
You do not have access to this page."
Inside tomcat orbeon log file it is showing following error:
392 INFO ProcessorService - Context listener - Context initialized.
522 INFO ProcessorService - Servlet initialized.
724 INFO ProcessorService - /xforms-renderer - Received request
192 INFO PageFlowControllerProcessor - unauthorized {controller: "oxf:/ops/xforms/xforms-renderer-page-flow.xml", method: "POST", path: "/xforms-renderer", status-code: "403"}
205 INFO ProcessorService - /xforms-renderer - Timing: 2465
I used RequestDispatcher in my servlet to forward my request for required XForm
ServletContext context= getServletContext();
RequestDispatcher rd= context.getRequestDispatcher("/xforms-jsp/orbeon/form.jsp");
rd.forward(request, response);
I am able to render xfrom while implementing as a integrated deployment.
May you guide where I am getting wrong.
Thanks!
If you're using separate deployment, you should be using the Orbeon servlet filter in your web.xml, and you don't need to use a RequestDispatcher in your own code. I double-checked this now with 4.0 to verify it works. (I am wondering what led you to believe that you needed to use your own RequestDispatcher, as I don't see anything about this in the separate deployment documentation.)
Note however that because of this issue, for now you also need to add the orbeon class on the <body> of your HTML, otherwise the proper styles won't apply. This is just temporary, and the class will be added automatically for you when this issue is fixed.

Resources