GCP API for Cloud SQL User doesn't fetch password - api

I am trying to get information about the users of a specific SQL Database Instance by using the Google.Apis.SQLAdmin API:
The return value contain a List of Users.
User:
{
"kind": string,
"password": string,
"etag": string,
"name": string,
"host": string,
"instance": string,
"project": string,
"type": enum (SqlUserType),
"sqlserverUserDetails": {
object (SqlServerUserDetails)
}
}
The "password" field remain null, no matter what I change through the GCP console.
Is there a reason for that? Am I missing a request parameter that will fetch this data?
Tried MySQL 5.7 and MySQL 8.0.
I don't need the password itself I just need to know if there is a password and it exist (also in the .net library the User class contain "PasswordPolicy").
This is the place in console where I add\change the password:
ImageOfTheConsole
Here you can see the api request and to try it using the right sided "Try This API":
https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/users/list
An example of a response I get for user with and a user without password:
{
"kind": "sql#usersList",
"items": [
{
"kind": "sql#user",
"etag": etag,
"name": "noPasswordUser",
"host": "%",
"instance": "my-1-test",
"project": "my-project"
},
{
"kind": "sql#user",
"etag": etag,
"name": "withPass",
"host": "%",
"instance": "my-1-test",
"project": "my-project"
}
]
}
Thank you.

Related

Hashicorp Vault LDAP authentication issues

We use LDAP as our access into Hashicorp Vault.
One of our users was deleted and recreated in AD... This use cannot log into the vault any longer, receiving a "Authentication failed: internal error" (rather than a "Authentication failed: ldap operation failed" that we see for a user that is not in AD or with an invalid password)
The only error we see is in the vault_audit.log (with passwords, and assessors munged, ip changed, and replaced with my name as example):
{
"time": "2022-09-12T19:03:55.457492415Z",
"type": "response",
"auth": {
"client_token": "hmac-sha256:xxxxxxx",
"accessor": "hmac-sha256:yyyyyyy",
"display_name": "ldap-ssiegler",
"token_policies": [
"default"
],
"metadata": {
"username": "ssiegler"
},
"entity_id": "aca5c682-b0c4-2f51-9681-b4244a23720b",
"token_type": "service"
},
"request": {
"id": "275b5b49-80ff-ee5f-a7f8-1e0c5a3dc645",
"operation": "update",
"namespace": {
"id": "root"
},
"path": "auth/ldap/login/ssiegler",
"data": {
"password": "hmac-sha256:zzzzzzz"
},
"remote_address": "192.168.205.23"
},
"response": {},
"error": "internal error"
}
"error": "internal error"
being the only information...
I have removed the entities that referenced this user, with no change, and created a new entity that was able to have this ad user as an alias, so AD sees him...
Ideas?

Chef Automate API

Starting to use the Chef Automate API.
I'm new to using APIs and I am confused as to what they mean by "Authorization Action" as listed on the documentation site:
I am using Postman as my utility/tool, and I have a Chef Automate admin API key. When I do a query:
GET {{ChefAutomateURL}}/apis/iam/v2/users?id=userid3
I would assume the reply would be only for that single user, but instead i'm getting everyone returned:
{
"users": [
{
"name": "user1",
"id": "userid1",
"membership_id": "a745cc00-8521-42a6-97ca-a60ccef931"
},
{
"name": "user2",
"id": "userid2",
"membership_id": "22e8e761-443b-45a3-9bdf-6ab4ccf79a"
},
{
"name": "user3",
"id": "userid3",
"membership_id": "67d2e924-2424-44d0-854d-c303f6c5ec"
}
]
}
... and I'm really confused as to why this isn't working.
This extends into my real desire, which is creating a local admin user, but again, when I try to do that, the response is just a JSON body with everyone:
POST {{ChefAutomateURL}}/apis/iam/v2/users
with this raw body:
{
"id": "userid4",
"name": "user4",
"password": "str0ng_password!"
}
I get a 200(OK) response like:
{
"users": [
{
"name": "user1",
"id": "userid1",
"membership_id": "a745cc00-8521-42a6-97ca-a60ccef931"
},
{
"name": "user2",
"id": "userid2",
"membership_id": "22e8e761-443b-45a3-9bdf-6ab4ccf79a"
},
{
"name": "user3",
"id": "userid3",
"membership_id": "67d2e924-2424-44d0-854d-c303f6c5ec"
}
]
}
I assume it has something to do with the "Authorization Action" as that's the only thing I'm not explicitly sending, but I don't understand what that is, or where/how it fits into the query.
I appreciate the help, thank you!

Authenticating via Okta that uses 2FA

I built a simple asp.net core application and need to authenticate an account that uses MFA in addition to username & password.
The service I'm trying to log into exposes an authentication endpoint described here:
https://developer.okta.com/docs/reference/api/authn/#request-example-for-primary-authentication-with-public-application
When I provide the username and password it returns the expected JSON:
{
"stateToken": "00zQZJ1ZY3Em2401r4T69Dhx35TdF1VTFP5KRTa8ib",
"expiresAt": "2020-05-30T21:11:14.000Z",
"status": "MFA_REQUIRED",
"_embedded": {
"user": {
"id": "00u10vk1torIgBBxxxxx",
"profile": {
"login": "john.doe#email.com",
"firstName": "John",
"lastName": "Doe",
"locale": "en",
"timeZone": "America/Los_Angeles"
}
},
"factors": [{
"id": "ost1g59468dXOddAE0h8",
"factorType": "token:software:totp",
"provider": "OKTA",
"vendorName": "OKTA",
"profile": {
"credentialId": "john.doe#email.com"
},
"_links": {
"verify": {
"href": "https://company.okta.com/api/v1/authn/factors/ost1g59468dXOddxxxxx/verify",
"hints": {
"allow": ["POST"]
}
}
}
}, {
Does anyone know who I can also add 2FA into the request to get it to work?

contentDetails don't exist in some responses of Activities with YouTube Data API v3

I have a problem on using YouTube API.
I requested as follows:
http://www.googleapis.com/youtube/v3/activities?part=contentDetails&channelId={CHANNEL_ID}&key={YOUR_API_KEY}
Then I received the response:
{
"kind": "youtube#activityListResponse",
....
"items": [
{
"kind": "youtube#activity",
"etag": etag1,
"id": id1,
},
....
There is no property of contentDetails although I specified it. It exists in the next activity.
....
{
"kind": "youtube#activity",
"etag": etag2,
"id": id2,
"contentDetails":{
"upload":{
"videoID": videoed
}
}
},
....
What does it depend on whether contentDetails exist? In fact the first activity is "bulletin" whereas the second one is "upload". Do this concern?
This is the expected response of contentDetails- it only returns the videoId. You can see that in Activities resource
"contentDetails": {
"upload": {
"videoId": string
}
You can even try this in Google API Explorer Activities.list, be sure to tick "all" in "use fields editor".
If you want a more detailed response, use snippet:
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
},
"channelTitle": string,
"type": string,
"groupId": string
}

Update Account (PUT) Endpoint in new Yodlee API for MFA

Background
I am using the newer Yodlee Aggregation API that differs from what I was previously building off of.
I am currently using this endpoint in the account registration flow to put the MFA response:
PUT /{cobrandName}/v1/providers/{providerAccountId}
My request looks like this:
{
url: `${this.rest}providers/${providerAccountId}`,
headers: {
'Authorization': `cobSession=${self.appToken}, userSession=${token}`
},
form: {
'MFAChallenge': JSON.stringify(newMfa)
}
}
where this.rest is my personal rest url, providerAccountId is the appropriate providerAccountId for the refresh, self.appToken is the current cobrand session token, token is the current user's login token, and newMfa is a JSON object being stringified that matches this profile:
{
"loginForm": {
"mfaTimeout": 94650,
"formType": "questionAndAnswer",
"row": [
{
"id": "SQandA--QUESTION_1--Row--1",
"fieldRowChoice": "0001",
"form": "0001",
"label": "What is the name of your state?",
"field": [
{
"id": "SQandA_QUESTION_1_1",
"name": "QUESTION_1",
"isOptional": false,
"value": "Enter the answer",
"valueEditable": true,
"type": "text"
}
]
},
{
"id": "SQandA--QUESTION_2--Row--2",
"fieldRowChoice": "0001",
"form": "0001",
"label": "What is the name of your first school",
"field": [
{
"id": "SQandA_QUESTION_2_2",
"name": "QUESTION_2",
"isOptional": false,
"value": "Enter the answer",
"valueEditable": true,
"type": "text"
}
]
}
]
}
with the exeption being the value fields of the field object, which have been encrypted with PKI as per instructions.
Issue
However, when I carry out this PUT request, I get this error from Yodlee:
{ errorCode: 'Y803',
errorMessage: 'MFAChallenge or providerParam required',
referenceCode: 'p1460412835654A4Q24t' }
though I clearly have an MFAChallenge parameter in my form. Any ideas on why I could be getting this error if the MFAChallenge is present (and note that it is the only info that is passed through the PUT request other than through headers or url parameters)? I tried putting it through as body data, but that doesn't seem to work, and very few of the API endpoints actually seem to use body over form encoded strings, though there was at least one.
You have to send this information MFAChallenge as part of URL, see below example
https://developer.api.yodlee.com/ysl/restserver/v1/providers/10114184?MFAChallenge=%7B%20%22loginForm%22%3A%20%7B%20%20%20%20%20%22mfaTimeout%22%3A%2094650%2C%20%20%20%20%20%22formType%22%3A%20%22questionAndAnswer%22%2C%20%20%20%20%20%22row%22%3A%20%5B%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA--QUESTION_1--Row--1%22%2C%20%20%20%20%20%20%20%20%20%22fieldRowChoice%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22form%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22label%22%3A%20%22What%20is%20the%20name%20of%20your%20state%3F%22%2C%20%20%20%20%20%20%20%20%20%22field%22%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA_QUESTION_1_1%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22QUESTION_1%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22isOptional%22%3A%20false%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22Enter%20the%20answer%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22valueEditable%22%3A%20true%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22text%22%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%7D%2C%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA--QUESTION_2--Row--2%22%2C%20%20%20%20%20%20%20%20%20%22fieldRowChoice%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22form%22%3A%20%220001%22%2C%20%20%20%20%20%20%20%20%20%22label%22%3A%20%22What%20is%20the%20name%20of%20your%20first%20school%22%2C%20%20%20%20%20%20%20%20%20%22field%22%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22id%22%3A%20%22SQandA_QUESTION_2_2%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22name%22%3A%20%22QUESTION_2%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22isOptional%22%3A%20false%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%22Enter%20the%20answer%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22valueEditable%22%3A%20true%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22text%22%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%20%20%20%20%20%20%20%20%5D%20%20%20%20%20%7D%20%5D%20%7D