package com.qmth.ops.api.security; import com.qmth.boot.core.security.annotation.AuthorizationComponent; import com.qmth.boot.core.security.service.AuthorizationService; import com.qmth.boot.core.sms.model.SmsConstants; import com.qmth.boot.tools.signature.SignatureType; import com.qmth.ops.api.constants.OpsApiConstants; import com.qmth.ops.biz.domain.Deploy; import com.qmth.ops.biz.service.DeployService; import javax.annotation.Resource; @AuthorizationComponent(prefix = { OpsApiConstants.OPEN_URI_PREFIX, SmsConstants.API_PATH_PREFIX }, type = SignatureType.SECRET) public class OpenAuthorizationService implements AuthorizationService, OpsApiConstants { @Resource private DeployService deployService; @Override public AccessDeploy findByIdentity(String identity, SignatureType signatureType, String path) { Deploy deploy = deployService.findByAccessKey(identity); if (deploy != null) { if (deploy.getControl() != null && !deploy.getControl().hasExpired()) { return new AccessDeploy(deploy); } } return null; } }