|
@@ -1,20 +1,31 @@
|
|
|
package cn.com.qmth.markingaudit.service.impl;
|
|
|
|
|
|
+import java.security.NoSuchAlgorithmException;
|
|
|
+
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.qmth.boot.core.security.annotation.AuthorizationComponent;
|
|
|
import com.qmth.boot.core.security.service.AuthorizationService;
|
|
|
import com.qmth.boot.tools.signature.SignatureType;
|
|
|
-import cn.com.qmth.markingaudit.bean.Constants;
|
|
|
|
|
|
import cn.com.qmth.markingaudit.bean.AccessInfo;
|
|
|
+import cn.com.qmth.markingaudit.bean.CustConstants;
|
|
|
+import cn.com.qmth.markingaudit.utils.MD5Util;
|
|
|
|
|
|
@Service
|
|
|
-@AuthorizationComponent(prefix = { Constants.URI_PREFIX }, type = SignatureType.SECRET)
|
|
|
+@AuthorizationComponent(prefix = { CustConstants.URI_PREFIX }, type = SignatureType.SECRET)
|
|
|
public class AuthServiceImpl implements AuthorizationService<AccessInfo> {
|
|
|
|
|
|
@Override
|
|
|
public AccessInfo findByIdentity(String identity, SignatureType signatureType, String path) {
|
|
|
- return new AccessInfo(identity, identity + "1", identity);
|
|
|
+ try {
|
|
|
+ StringBuilder temp = new StringBuilder(identity);
|
|
|
+ temp.reverse();
|
|
|
+ temp.append(CustConstants.QMTH);
|
|
|
+ String secret = MD5Util.encoder(temp.toString());
|
|
|
+ return new AccessInfo(identity, secret, identity);
|
|
|
+ } catch (NoSuchAlgorithmException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|