Write a Plug-in for Cloud foundry authentication - cloud-foundry

I need to integrate the Cloudfoundry with third party authentication tool, say, Keystone. I need to write a plug-in where it can be attached / installed to the cloud foundry with out any code changes in Cloudfoundry. If I want to use the authentication from keystone I will install the plug-in for Cloudfoundry. The code changes should only go to the plug-in and not to the Cloudfoundry code.
Please let me know how can I achieve this.
Thanks in advance,
Sateesh B.

The following link https://github.com/cloudfoundry/vcap-java-client is a java client library that does restful calls to vcap (aka cloud foundry). Now in my opinion, if you want to use a custom authentication method (be whatever you choose) in high level terms, you would have to make it into a adapter design pattern.
Once your users pass your authentication, your application can then communicate with Cloud Foundry via rest calls or libraries such as https://github.com/cloudfoundry/vcap-java-client and have their account created or etc. You just have to add that layer of your own authentication which then you can use the data from the authenticated user in creating or fetching cloud foundry info/apps.
This way you haven't touched cloud foundry and you can easily implement more than one way of authentication.

Related

How to remake `gcloud run deploy` with .NET Cloud Client Libraries?

I am trying to deploy an already built image to Cloud Run using .NET Cloud Client Libraries.
I need exactly the same behavior as gcloud run deploy hello --image=us-docker.pkg.dev/cloudrun/container/hello but with .NET Cloud Client Libraries.
Unfortunately, I cannot find an API that does that in https://cloud.google.com/dotnet/docs/reference.
I also tried downloading Cloud SDK from https://cloud.google.com/sdk/docs/install and inspecting the code with PyCharm.
The API is called Cloud Run Admin API.
Cloud Run Admin API
There is an SDK for .NET.
Cloud Run Admin API Client Library for .NET
Namespace Google.Apis.CloudRun.v1
Creating a Cloud Run service is fairly complicated. I recommend that you study the REST API first so that you understand the request body. The .NET library models the REST API.
Method: namespaces.services.create
The key item is the service resource:
Resource: Service
There is a quick way to learn the API request body. Create a simple Cloud Run example and then add the command line option --log-http. Save the output to a file and then study the HTTP request parameters and request body to decipher the very large data structures that are required to create a service.
gcloud run deploy --log-http
I wrote two articles on the Cloud Run Admin API:
Google Cloud Run Deep Dive – Understanding the APIs – Part 1
Google Cloud Run Deep Dive – Understanding the APIs – Part 2
Note: I wrote those articles two years ago. Cloud Run has advanced a lot since then. However, these articles will help you understand the low-level details of the service that were not published elsewhere at the time.

OAuth2 consent setup for individual private application

I'm trying to send prediction requests to the google cloud ai platform from an android application. In order to do this I seem to need OAuth2 verification. I do not want to use the 'External' option as it is not an external application and will only be used by yours truly, but I cannot use the 'Internal' application without a G Suite account.
You can use Google Cloud Functions, please take a look at this Blog Post.
Basically you can call Cloud Functions directly and Cloud Functions take care of the authentication to AI Platform.
Also this may help:
https://cloud.google.com/blog/products/ai-machine-learning/how-to-serve-deep-learning-models-using-tensorflow-2-0-with-cloud-functions

Is it possible for a java web app to interact with a blockchain built with HyperLedger Composer?

Or do you have to build the web application using a certain language to use composer? I've been looking this up but I'm confused how a web app would use the blockchain.
Yes, this is the purpose of the composer-rest-server which has a Swagger (OpenAPI) documented RESTful interface that allows one to interact with a Composer business network.
This is documented in the "Generate REST API" section of the Developer Guide.
After you create and composer deploy your .bna (business network archive) you would use the composer-rest-server command-line tool to generate and start a rest server that can interact with your business network.
Using this REST API, you can access the swagger definition source via http://localhost:3000/explorer/swagger.json. From that, you can generate a Java client using a tool such as Swagger Codegen.
Yes, you can do that exposing the business network as a REST API & invoking that from any web application.
See this: https://hyperledger.github.io/composer/integrating/getting-started-rest-api.html

Creating a Mult-Tenant OAuth Client App

Essentially, I'm wanting to create an Oauth Client as an App so I can get data from Dynamics for multiple customers. Does anyone know if this is possible to do in AppSource or do you know of another way?
I have a service that will be served in a cloud different than Azure so there really isn't anything for me to submit as an App and I really don't want every customer to have to setup their own App that gives my service the privileges/access it needs, but it's looking like I may have to.
It sounds like you'll want to register an app with Azure AD (the OAuth2.0 service/identity provider for work and school accounts), and create a multi-tenant app. Then you can configure this app in the Azure Portal to get permissions to the APIs the app wants tokens to call (in your case Dynamics or the Microsoft Graph).
Once this app is written, you can code up your app using one of the Azure AD Auth Libraries. Here's some sample code for a .NET web API. You can find more code samples on Github and search active directory. Moreover, the Azure Active Directory Developer Landing Page is a great place to look for more resources on doing all of this.

how to publish and discover a java web service

I am new to developing web services using java. I have an academic project where I need to do dynamic service composition. For that I can't directly create a service-client for a particular service because if I do so then that client will call that particular service only. Client need to search various web services and then out of those services select any one at run time and also call that service at run time.
I was able to develop the web service(JAX-WS) using Eclipse(indigo), I also created the client for that web service and every thing is working fine. Now my problem is that while creating the client I am hard coding the client to call that particular web service only(since I am creating the client using the WSDL file of the service). However I actually need to call any one of the searched service, but for that I need to publish the service some where then discover it and then call it.
I tried publishing the service to juddiv3. But on juddiv3 I could only publish the sample service supplied with the juddiv3. When I try to publish service created by me then it is not getting displayed in the group of published services.
Is there any other UDDI server which I could install on my local machine and then publish and discover the service from that. Also I was not able to figure out how to create a client that will modify itself at run time to call any one service out of various searched services.
Kindly provide the necessary steps and code.
Thanks
You can use jUDDI (http://juddi.apache.org/ ).
juddi is based on UDDI v2.0, v 3.0 .
Here, you can publish as well as discover your web service.
For integration, you have to make some application which integrates with jUDDI.
But I think for your academic project, and for your purpose, jUDDI is best suitable! ( :) )
jUDDI has a boat load of examples in the source code trunk. You may want to check them out. It's difficult to guess what the problem is from the little information you've provided. Consider contacting the jUDDI team for further assistance. http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/. There's also additional document for working with UDDI in the jUDDI user's guide, which is at the jUDDI web site
You cannot directly publish on jUDDI. You need to create publisher entities in jUDDI server also. You'll find Rename4Sales and Rename4Marketing examples in 'Classes' folder in the standalone server's juddi application. Use these XMLs as your basis and create your own entity. You also need to configure the server's login credentials.
I suggest you follow the tutorials on jUDDI blog.