AdminSamlSecurityContainer.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { Container } from 'unstated';
  2. import loggerFactory from '@alias/logger';
  3. // eslint-disable-next-line no-unused-vars
  4. const logger = loggerFactory('growi:security:AdminSamlSecurityContainer');
  5. /**
  6. * Service container for admin security page (SecuritySamlSetting.jsx)
  7. * @extends {Container} unstated Container
  8. */
  9. export default class AdminSamlSecurityContainer extends Container {
  10. constructor(appContainer) {
  11. super();
  12. this.appContainer = appContainer;
  13. this.state = {
  14. // TODO GW-583 set value
  15. useOnlyEnvVars: false,
  16. appSiteUrl: false,
  17. callbackUrl: 'hoge.com',
  18. missingMandatoryConfigKeys: [],
  19. samlDbEntryPoint: '',
  20. samlEnvVarEntryPoint: '',
  21. samlDbIssuer: '',
  22. samlEnvVarIssuer: '',
  23. samlDbCert: '',
  24. samlEnvVarCert: '',
  25. samlDbAttrMapId: '',
  26. samlEnvVarAttrMapId: '',
  27. samlDbAttrMapUserName: '',
  28. samlEnvVarAttrMapUserName: '',
  29. samlDbAttrMapMail: '',
  30. samlEnvVarAttrMapMail: '',
  31. };
  32. this.init();
  33. }
  34. init() {
  35. // TODO GW-583 fetch config value with api
  36. }
  37. /**
  38. * Workaround for the mangling in production build to break constructor.name
  39. */
  40. static getClassName() {
  41. return 'AdminSamlSecurityContainer';
  42. }
  43. /**
  44. * Change samlDbEntryPoint
  45. */
  46. changeSamlDbEntryPoint(inputValue) {
  47. this.setState({ samlDbEntryPoint: inputValue });
  48. }
  49. /**
  50. * Change samlDbIssuer
  51. */
  52. changeSamlDbIssuer(inputValue) {
  53. this.setState({ samlDbIssuer: inputValue });
  54. }
  55. /**
  56. * Change SamlDbCert
  57. */
  58. changeSamlDbCert(inputValue) {
  59. this.setState({ samlDbCert: inputValue });
  60. }
  61. /**
  62. * Change samlDbAttrMapId
  63. */
  64. changeSamlDbAttrMapId(inputValue) {
  65. this.setState({ samlDbAttrMapId: inputValue });
  66. }
  67. /**
  68. * Change samlDbAttrMapUserName
  69. */
  70. changeSamlDbAttrMapUserName(inputValue) {
  71. this.setState({ samlDbAttrMapUserName: inputValue });
  72. }
  73. /**
  74. * Change samlDbAttrMapMail
  75. */
  76. changeSamlDbAttrMapMail(inputValue) {
  77. this.setState({ samlDbAttrMapMail: inputValue });
  78. }
  79. }