Class LicenseKeyController


  • @RestController
    public class LicenseKeyController
    extends Object
    Controller class that provides various methods for license key management such as to generate license key for a specified TSP ID, mapping several permissions to a generated license key, fetching the specified permissions for a license key.
    Since:
    1.0.0
    Author:
    Sagar Mahapatra
    • Constructor Detail

      • LicenseKeyController

        public LicenseKeyController()
    • Method Detail

      • generateLicenseKey

        @PreAuthorize("hasAnyRole(@lkeyAuthRoles.getPostlicensegenerate())")
        @ResponseFilter
        @PostMapping("/license/generate")
        public io.mosip.kernel.core.http.ResponseWrapper<LicenseKeyGenerationResponseDto> generateLicenseKey​(@RequestBody
                                                                                                             io.mosip.kernel.core.http.RequestWrapper<LicenseKeyGenerationDto> licenseKeyGenerationDto)
        This method will generate license key against a certain TSP ID.
        Parameters:
        licenseKeyGenerationDto - the LicenseKeyGenerationResponseDto request object wrapped in RequestWrapper.
        Returns:
        the response entity.
      • mapLicenseKey

        @ResponseFilter
        @PostMapping("/license/permission")
        public io.mosip.kernel.core.http.ResponseWrapper<LicenseKeyMappingResponseDto> mapLicenseKey​(@RequestBody
                                                                                                     io.mosip.kernel.core.http.RequestWrapper<LicenseKeyMappingDto> licenseKeyMappingDto)
        This method will map license key to several permissions. The permissions provided must be present in the master list.
        Parameters:
        licenseKeyMappingDto - the LicenseKeyMappingDto.
        Returns:
        the response entity.
      • fetchLicenseKeyPermissions

        @ResponseFilter
        @GetMapping("/license/permission")
        public io.mosip.kernel.core.http.ResponseWrapper<LicenseKeyFetchResponseDto> fetchLicenseKeyPermissions​(@RequestParam("tspId")
                                                                                                                String tspId,
                                                                                                                @RequestParam("licenseKey")
                                                                                                                String licenseKey)
        This method will fetch the mapped permissions for a license key.
        Parameters:
        tspId - tsp id
        licenseKey - the license key of which the permissions need to be fetched.
        Returns:
        the permissions fetched.