|
34 | 34 | AUTH_TYPE_LABEL = "Event Stream Authentication Type"
|
35 | 35 | SIGNATURE_ENCODING_LABEL = "Signature Encoding"
|
36 | 36 | HTTP_HEADER_LABEL = "HTTP Header Key"
|
| 37 | +DEPRECATED_CREDENTIAL_KINDS = ["mtls"] |
37 | 38 | # FIXME(cutwater): Role descriptions were taken from the RBAC design document
|
38 | 39 | # and must be updated.
|
39 | 40 | ORG_ROLES = [
|
|
640 | 641 | ],
|
641 | 642 | }
|
642 | 643 |
|
643 |
| -EVENT_STREAM_MTLS_INPUTS = { |
644 |
| - "fields": [ |
645 |
| - { |
646 |
| - "id": "auth_type", |
647 |
| - "label": AUTH_TYPE_LABEL, |
648 |
| - "type": "string", |
649 |
| - "default": "mtls", |
650 |
| - "hidden": True, |
651 |
| - }, |
652 |
| - { |
653 |
| - "id": "subject", |
654 |
| - "label": "Certificate Subject", |
655 |
| - "type": "string", |
656 |
| - "help_text": ( |
657 |
| - "The Subject from Certificate compliant with RFC 2253." |
658 |
| - "This is optional and can be used to check the subject " |
659 |
| - "defined in the certificate." |
660 |
| - ), |
661 |
| - }, |
662 |
| - { |
663 |
| - "id": "http_header_key", |
664 |
| - "label": HTTP_HEADER_LABEL, |
665 |
| - "type": "string", |
666 |
| - "default": "Subject", |
667 |
| - "help_text": ( |
668 |
| - "The NGINX Server passes the certificate subject using " |
669 |
| - "this HTTP header" |
670 |
| - ), |
671 |
| - "hidden": True, |
672 |
| - }, |
673 |
| - ], |
674 |
| - "required": ["auth_type", "http_header_key"], |
675 |
| -} |
676 | 644 |
|
677 | 645 | EVENT_STREAM_GITLAB_INPUTS = {
|
678 | 646 | "fields": [
|
|
989 | 957 | "the signature."
|
990 | 958 | ),
|
991 | 959 | },
|
992 |
| - { |
993 |
| - "name": enums.EventStreamCredentialType.MTLS, |
994 |
| - "namespace": "event_stream", |
995 |
| - "kind": "mtls", |
996 |
| - "inputs": EVENT_STREAM_MTLS_INPUTS, |
997 |
| - "injectors": {}, |
998 |
| - "managed": True, |
999 |
| - "description": ( |
1000 |
| - "Credential for Event Streams that use mutual TLS. " |
1001 |
| - "The Certificate is installed in the Web Server and " |
1002 |
| - "we can optionally validate the Subject defined in the " |
1003 |
| - "Certificate." |
1004 |
| - ), |
1005 |
| - }, |
1006 | 960 | {
|
1007 | 961 | "name": enums.CustomEventStreamCredentialType.GITLAB,
|
1008 | 962 | "namespace": "event_stream",
|
@@ -1088,8 +1042,16 @@ def handle(self, *args, **options):
|
1088 | 1042 | self._copy_scm_credentials()
|
1089 | 1043 | self._create_org_roles()
|
1090 | 1044 | self._create_obj_roles()
|
| 1045 | + self._remove_deprecated_credential_kinds() |
1091 | 1046 | enable_redis_prefix()
|
1092 | 1047 |
|
| 1048 | + def _remove_deprecated_credential_kinds(self): |
| 1049 | + """Remove old credential types which are deprecated.""" |
| 1050 | + for credential_type in models.CredentialType.objects.filter( |
| 1051 | + kind__in=DEPRECATED_CREDENTIAL_KINDS |
| 1052 | + ).all(): |
| 1053 | + credential_type.delete() |
| 1054 | + |
1093 | 1055 | def _preload_credential_types(self):
|
1094 | 1056 | for credential_type in populate_credential_types(CREDENTIAL_TYPES):
|
1095 | 1057 | self.stdout.write(
|
|
0 commit comments