authenticate to Google Cloud Platform from a Linux Server - linux

I have developed a java program that involves API connections, DataFlow pipelines and BigQuery to load data.
Locally in my computer it works fine with GCP authenticator and running pipelines in the cloud.
But when I run a class in the linux server it ask me for authentication but with an url.
this is the output in the server
I tried "gcloud init" sending credentials but it still asking me for authentication.
has anyone faced this situation?
thanks!

Your application is attempting to use OAuth 2.0 Flow to obtain credentials. Since your server does not have a web browser, you are given a URL to go to in your browser. Once you do that you will receive a code to copy-and-paste back into your server.
The solution is to change your program to use Google Service Account Credentials.
This link has a detailed explanation and code examples including Java.
Setting Up Authentication for Server to Server Production Applications

Related

How to make an API accessible all the time and not just when the project is executed?

I am making my first mobile app using Xamarin.Forms and FreshMVVM as the architecture and I want this app to get info off my SQL database (which is located in azure) by calling an API Rest. I already know how to develop an Api, and all the SQL and Azure related stuff, as well as how to get info from my API.
But what I don't know is how to access this API when the project in which is created is not executed, in other words, I don't know how to make my API Rest accessible all the time, so the App can access to it whenever is needed.
How do you do this?
Thank you all for your time, hope you have a good day.
You need to publish the API to a web host. Azure App Services. AWS. Digital Ocean VM running a web server. Possibly GoDaddy, though I have never used them. Your own server.

Mock a Https destination to connect to system behind OAuth2 authentication

Use Case :: Trying to mock a destination that would help us connect to a cloud S4 system behind an IDP and requires Oauth2 authentication.
I have been able to mock a local destination to connect to system behind basic authentication.
We are trying to understand how to mock the additional components susch as XSUAA service that would require us to generate the token
We want to use this destination to enable us to connect to remote systems locally without modifying the code developed for the cloud enviornment.
To basically recap the discussion in the comments:
It is not easily possible to consume Cloud Foundry services locally. The SDK reads many of the necessary configuration and credentials from the VCAP_SERVICES to communicate with those services. The only option, which is not recommended, is to copy this down locally. However, this poses security risks, as the environment variable contains sensitive information.
If the only reason is easier debugging of your application you could have a look at this answer to see how remote debugging can be set up.

Azure App and Services and IdentityServer4

I have a situation where I have a React Web App and two REST services using Identity4 Server.
Problem is that these work well locally in my Workstation but if I deploy these three parts into Azure they will not work.
I have Azure SQL Database containing all Databases and tables it needs. Locally I use my local Database. So, Database is not the problem. It's deployed in same way with Azures manner.
My question is that how should I configure a React Web App using Identity4 Server with REST services?
I thing that Azure needs some kind of proper configuration but dont't know what.
I also have read Identity4 Server's documention pages but haven't found anything there that would help mr installing it into Azure.
Can anyone help me with this issue? thanks
Br
Mike
One error is HTTP 401 Unauthorized error

Running Angular5 app locally against Azure AD protected backend

We have an Angular5 application with a DotNet OData backend API. The application is hosted in a Web Application with a virtual directory for the Angular5 app and another virtual directory for the DotNet backend. The web application is secured by Azure AD, with an Azure AD Application defined for the web site.
This all works perfectly. We have no authentication code in the front end (except for 'withCredentials: true' set in the service calls) but apparently having the whole application protected by Azure AD makes the front end able to call the backend without issue (Azure makes you authenticate when you access the Angular5 front end).
The problem comes when we try to develop the front end. When developing Angular5 one needs to run the Angular5 code locally, so I've set up a web app which hosts only the backend code and point the local configuration for the Angular5 app there. This fails with the first backend call with a 401. One of our developers discovered that if you simply plug in the URL to the backend with the same browser (i.e. copy the failing call from the browser network developer tab into a new browser tab in the same browser) you will go through the authentication process and then when you run the local Angular5 app again it works. We thought we had found a workaround until we noticed that for some reason this only seems to fix the "read only" calls. GET works, OPTIONS works but POST fails with a 401. I put some debugging code in the backend but it seems this code does not even get called (i.e. Azure, not our backend, is blocking the call).
So I've tried to figure out how to get the local Angular5 instance to behave as the one hosted by the Web app but I can't figure out what I need to be doing. I have also been unable to find anyone else doing this so I can't find a solution.
I have tried various solutions of actively getting a token (e.g. setting up /.auth/me, using adal5 to "login", etc.) for the front end but it seems every possible solution is defeated by CORS in the end. Our backend has an Allow-Origin for localhost:4200 but this doesn't apply to login.windows.com for the authentication step. I tried putting localhost:4200 in the CORS setting on the Azure Web App but then it complains about an Allow-Authentication header being missing and I have no way to force Azure to provide that. I read online that this is happening because Azure didn't expect people to be using "cookie authentication" so after some research I found that "cookie authentication" was being used because of the "withCredentials: true" calls, so I changed all of those to false. Then the Allow-Authentication failure goes away but I just run into more CORS failures during the authorisation (login.windows.com).
So I'm really stuck here. I can't believe I'm the only person on earth who's trying to run a local instance of Angular5 against an Azure AD secured Azure Web app backend but I can't find any examples anywhere of people successfully doing this. I also would like to avoid having to do some elaborate local authentication because the code works perfectly as-is when hosted on the same Azure Web app as the backend. Does anyone have a setup like I describe that is working?

kerberos authentication setup for postgresql in REDHAT environment

Our backend is running with PostgreSql in REDHAT environment.Here we need to implement a kerberos authentication.what will be the configuration changes required to perform this.
example: google. once we login to google.com we can access google+, google drive, google apps.. without again providing password.
I too need a similar setup. but my requirment is my client wants to connect through windows as front-end where RHEL is using as backend. so, i have a vague idea thats going to work out with Active Directory configuration. but guide me on how to setup kerberos using AD on RHEL.

Resources