以编程方式为Google云启用IAP(身份识别代理)

时间:2018-01-12 16:04:19

标签: curl google-cloud-platform app-engine-flexible google-kubernetes-engine google-iap

我试图找到一种方法,以编程方式为我们在GKE(Google Kubernetes Engine)上的应用启用IAP(身份识别代理)。为此,我首先要创建一个" OAuth 2.0客户端ID"。使用开发人员工具,我能够获得此CURL命令来创建clientId" IAP-meow-meow-meow"。

有没有人有任何想法如何使用此CURL命令或其他方法进行身份验证以创建此对象?

https://cloud.google.com/iap/docs/enabling-gce-howto

REQUEST

$ curl 'https://clientauthconfig.clients6.google.com/v1/clients?alt=json&key=AIzaSyCI-zsRP85UVOi0DjtiCwWBwQ1djDy741g' \
>      -H 'Host: clientauthconfig.clients6.google.com' \
>      -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0' \
>      -H 'Accept: */*' \
>      -H 'Accept-Language: en-US,en;q=0.5' \
>      --compressed -H 'Referer: https://clientauthconfig.clients6.google.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.tZDXb_qbHrc.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLfTcCOgQjGru3rduZo70XwAerRmnfOfOeA' \
>      -H 'X-ClientDetails: appVersion=5.0%20(X11)&platform=Linux%20x86_64&userAgent=Mozilla%2F5.0%20(X11%3B%20Ubuntu%3B%20Linux%20x86_64%3B%20rv%3A57.0)%20Gecko%2F20100101%20Firefox%2F57.0' \
>      -H 'Authorization: SAPISIDHASH 1515770459_0f3cfae9432ccfoobd6ae92a1794barde7ed07c2' \
>      -H 'X-Goog-AuthUser: 0' \
>      -H 'Content-Type: application/json' \
>      -H 'X-Requested-With: XMLHttpRequest' \
>      -H 'X-JavaScript-User-Agent: google-api-javascript-client/1.1.0' \
>      -H 'X-Origin: https://console.cloud.google.com' \
>      -H 'X-Referer: https://console.cloud.google.com' \
>      -H 'X-Goog-Encode-Response-If-Executable: base64' \
>      -H 'Cookie: NID=foo=barVrYZXJb34u17Mx6Q_9p57bvc5-zHUFWJjQejfoN6XgP2mAhBHE0jG6nS4ilYdRGc8_U6mEWLRaRlHfbCBsr8pZ1qoiEWVPIe-u8XBwuZwjy5rSoioSF_OVWFpitCfgB4SEEK8aM27xMlq2DgKTs2q36-fmFcEw; SID=owVQ_HOlHfooFo5z-tevS0CuR-qhN7vXSbEWat0e_i4tGRM2pefmfFBOiLgqfoo18gvNWw.; HSID=AyR9h7mPHjJKJI1SD; SSID=ANxWZzSoZySzHGYyZ; APISID=Oq-gokELHoOq8gWO/AJUeLJeMn7YHCG87J; SAPISID=lAyf0xSwAo7fUrbYQ/Acz3ZQ8vYSMTUbLru; SIDCC=AAiTGe-jD4R6_R9U1nQwKNARTyfzmR90toPQH2HyMk5EKtBM-L8zbarZysD1AqPtysWafoozw; 1P_JAR=2018-1-12-15' \
>      -H 'DNT: 1' \
>      -H 'Connection: keep-alive' \
>      --data '{"authType":"SHARED_SECRET","brandId":"[My_Brand_Id]","displayName":"IAP-meow-meow-meow","postMessageOrigins":[],"projectNumber":"[My_Project_Number]","redirectUris":[],"type":"WEB"}'

RESPONSE

{
  "clientId": "[My_Client_Id]",
  "projectNumber": "[My_Project_Number]",
  "brandId": "[My_Brand_Id]",
  "clientSecret": "[My_Client_Secret]",
  "serviceAccountId": "[My_Service_Account_Id]",
  "type": "WEB",
  "authType": "SHARED_SECRET",
  "securityRestrictions": {
    "grantHighRiskScopes": "DISABLED"
  },
  "updateTime": "2018-01-12T15:23:14.112694Z",
  "creationTime": "2018-01-12T15:23:14.018Z",
  "displayName": "IAP-meow-meow-meow",
  "threeLeggedOauth": "ENABLED",
  "domainWideDelegation": "DELEGATION_ENABLED",
  "adminState": {
    "updateTime": "2018-01-12T15:23:14.018Z"
  },
  "assertionMatchExistingGrant": "MATCH_GRANT_DISABLED"
}

0 个答案:

没有答案