Class KeymanagerController


  • @CrossOrigin
    @RestController
    public class KeymanagerController
    extends Object
    This class provides controller methods for Key manager.
    Since:
    1.0.0
    Author:
    Dharmesh Khandelwal, Urvil Joshi
    • Constructor Detail

      • KeymanagerController

        public KeymanagerController()
    • Method Detail

      • generateMasterKey

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getPostgeneratemasterkeyobjecttype())")
        @ResponseFilter
        @PostMapping("/generateMasterKey/{objectType}")
        public io.mosip.kernel.core.http.ResponseWrapper<KeyPairGenerateResponseDto> generateMasterKey​(@PathVariable("objectType")
                                                                                                       String objectType,
                                                                                                       @RequestBody @Valid
                                                                                                       @Valid io.mosip.kernel.core.http.RequestWrapper<KeyPairGenerateRequestDto> keyPairGenRequestDto)
        Generate Master Key for the provided APP ID.
        Parameters:
        objectType - response Object Type. Support types are Certificate/CSR. Path Parameter.
        keyPairGenRequestDto - KeyPairGenerateRequestDto request
        Returns:
        KeyPairGenerateResponseDto instance
      • getCertificate

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getGetgetcertificate())")
        @ResponseFilter
        @GetMapping("/getCertificate")
        public io.mosip.kernel.core.http.ResponseWrapper<KeyPairGenerateResponseDto> getCertificate​(@RequestParam("applicationId")
                                                                                                    String applicationId,
                                                                                                    @RequestParam("referenceId")
                                                                                                    Optional<String> referenceId)
        Request to get Certificate for the Provided APP ID & REF ID.
        Parameters:
        applicationId - Application id of the application requesting Certificate
        referenceId - Reference id of the application requesting Certificate. Blank in case of Master Key.
        Returns:
        KeyPairGenerateResponseDto instance
      • generateCSR

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getPostgeneratecsr())")
        @ResponseFilter
        @PostMapping("/generateCSR")
        public io.mosip.kernel.core.http.ResponseWrapper<KeyPairGenerateResponseDto> generateCSR​(@RequestBody @Valid
                                                                                                 @Valid io.mosip.kernel.core.http.RequestWrapper<CSRGenerateRequestDto> csrGenRequestDto)
        Request to Generate CSR for the provided APP ID & REF ID along with other certificate params.
        Parameters:
        csrGenRequestDto - CSRGenerateRequestDto request
        Returns:
        KeyPairGenerateResponseDto instance
      • uploadOtherDomainCertificate

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getPostuploadotherdomaincertificate())")
        @ResponseFilter
        @PostMapping("/uploadOtherDomainCertificate")
        public io.mosip.kernel.core.http.ResponseWrapper<UploadCertificateResponseDto> uploadOtherDomainCertificate​(@RequestBody @Valid
                                                                                                                    @Valid io.mosip.kernel.core.http.RequestWrapper<UploadCertificateRequestDto> uploadCertRequestDto)
        Update signed certificate for the provided APP ID & REF ID for other domains.
        Parameters:
        uploadCertRequestDto - UploadCertificateRequestDto request
        Returns:
        UploadCertificateResponseDto instance
      • revokeKey

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getPutrevokekey())")
        @ResponseFilter
        @PutMapping("/revokeKey")
        public io.mosip.kernel.core.http.ResponseWrapper<RevokeKeyResponseDto> revokeKey​(@RequestBody @Valid
                                                                                         @Valid io.mosip.kernel.core.http.RequestWrapper<RevokeKeyRequestDto> revokeKeyRequestDto)
        Request to Revoke Base Key for the provided APP ID & REF ID.
        Parameters:
        revokeKeyRequestDto - RevokeKeyRequestDto request
        Returns:
        RevokeKeyResponseDto instance
      • getAllCertificates

        @PreAuthorize("hasAnyRole(@KeyManagerAuthRoles.getGetgetcertificate())")
        @ResponseFilter
        @GetMapping("/getAllCertificates")
        public io.mosip.kernel.core.http.ResponseWrapper<AllCertificatesDataResponseDto> getAllCertificates​(@RequestParam("applicationId")
                                                                                                            String applicationId,
                                                                                                            @RequestParam("referenceId")
                                                                                                            Optional<String> referenceId)
        Request to get all the Certificates for the Provided APP ID & REF ID.
        Parameters:
        applicationId - Application id of the application requesting Certificate
        referenceId - Reference id of the application requesting Certificate. Blank in case of Master Key.
        Returns:
        KeyPairGenerateResponseDto instance