oauthConfig.j2 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {% macro identity_provider_config(identity_provider) %}
  2. apiVersion: v1
  3. kind: {{ identity_provider.kind }}
  4. {% if identity_provider.kind == 'HTPasswdPasswordIdentityProvider' %}
  5. file: {{ identity_provider.filename }}
  6. {% elif identity_provider.kind == 'BasicAuthPasswordIdentityProvider' %}
  7. url: {{ identity_provider.url }}
  8. {% for key in ('ca', 'certFile', 'keyFile') %}
  9. {% if key in identity_provider %}
  10. {{ key }}: {{ identity_provider[key] }}"
  11. {% endif %}
  12. {% endfor %}
  13. {% elif identity_provider.kind == 'RequestHeaderIdentityProvider' %}
  14. headers: {{ identity_provider.headers }}
  15. {% if 'clientCA' in identity_provider %}
  16. clientCA: {{ identity_provider.clientCA }}
  17. {% endif %}
  18. {% elif identity_provider.kind == 'GitHubIdentityProvider' %}
  19. clientID: {{ identity_provider.clientID }}
  20. clientSecret: {{ identity_provider.clientSecret }}
  21. {% elif identity_provider.kind == 'GoogleIdentityProvider' %}
  22. clientID: {{ identity_provider.clientID }}
  23. clientSecret: {{ identity_provider.clientSecret }}
  24. {% if 'hostedDomain' in identity_provider %}
  25. hostedDomain: {{ identity_provider.hostedDomain }}
  26. {% endif %}
  27. {% elif identity_provider.kind == 'OpenIDIdentityProvider' %}
  28. clientID: {{ identity_provider.clientID }}
  29. clientSecret: {{ identity_provider.clientSecret }}
  30. claims:
  31. id: identity_provider.claims.id
  32. {% for claim_key in ('preferredUsername', 'name', 'email') %}
  33. {% if claim_key in identity_provider.claims %}
  34. {{ claim_key }}: {{ identity_provider.claims[claim_key] }}
  35. {% endif %}
  36. {% endfor %}
  37. urls:
  38. authorize: {{ identity_provider.urls.authorize }}
  39. token: {{ identity_provider.urls.token }}
  40. {% if 'userInfo' in identity_provider.urls %}
  41. userInfo: {{ identity_provider.userInfo }}
  42. {% endif %}
  43. {% if 'extraScopes' in identity_provider %}
  44. extraScopes:
  45. {% for scope in identity_provider.extraScopes %}
  46. - {{ scope }}
  47. {% endfor %}
  48. {% endif %}
  49. {% if 'extraAuthorizeParameters' in identity_provider %}
  50. extraAuthorizeParameters:
  51. {% for param_key, param_value in identity_provider.extraAuthorizeParameters.iteritems() %}
  52. {{ param_key }}: {{ param_value }}
  53. {% endfor %}
  54. {% endif %}
  55. {% endif %}
  56. {% endmacro %}
  57. oauthConfig:
  58. assetPublicURL: {{ openshift.master.public_console_url }}/
  59. grantConfig:
  60. method: {{ openshift.master.oauth_grant_method }}
  61. identityProviders:
  62. {% for identity_provider in openshift.master.identity_providers %}
  63. - name: {{ identity_provider.name }}
  64. challenge: {{ identity_provider.challenge }}
  65. login: {{ identity_provider.login }}
  66. provider:
  67. {{ identity_provider_config(identity_provider) }}
  68. {%- endfor %}
  69. masterPublicURL: {{ openshift.master.public_api_url }}
  70. masterURL: {{ openshift.master.api_url }}
  71. sessionConfig:
  72. sessionMaxAgeSeconds: {{ openshift.master.session_max_seconds }}
  73. sessionName: {{ openshift.master.session_name }}
  74. sessionSecretsFile: {{ openshift.master.session_secrets_file }}
  75. tokenConfig:
  76. accessTokenMaxAgeSeconds: {{ openshift.master.access_token_max_seconds }}
  77. authorizeTokenMaxAgeSeconds: {{ openshift.master.auth_token_max_seconds }}
  78. {# Comment to preserve newline after authorizeTokenMaxAgeSeconds #}