diff --git a/src/main/java/com/jingcheng/cms/service/CaseContentService.java b/src/main/java/com/jingcheng/cms/service/CaseContentService.java new file mode 100644 index 0000000..51df382 --- /dev/null +++ b/src/main/java/com/jingcheng/cms/service/CaseContentService.java @@ -0,0 +1,43 @@ +package com.jingcheng.cms.service; + +import com.alibaba.fastjson.JSONObject; +import com.jingcheng.cms.util.AjaxResult; +import com.jingcheng.cms.util.PageAjax; +import com.jingcheng.cms.vo.CaseContentBakVo; +import com.jingcheng.cms.vo.CaseContentDetailBakVo; +import com.jingcheng.cms.vo.CaseContentDetailVo; + +import java.io.UnsupportedEncodingException; + +public interface CaseContentService extends BaseService { + JSONObject getContentListByCategoryId(Long categoryId, Integer pageNum, Integer pageSize); + + CaseContentDetailVo getContentDetailByContentId(Long contentId) throws UnsupportedEncodingException; + + AjaxResult saveContent(JSONObject jsonObject); + + AjaxResult delContent(Long contentId); + + /** + * 后台搜索文章 + * @param name + * @param level1 + * @param level2 + * @param level3 + * @return + */ + PageAjax searchBakContentByParam(String name, Long level1, Long level2, Long level3, Integer pageNum); + + CaseContentDetailBakVo getCaseContentDetailBakVoByContentID(Long contentId) throws UnsupportedEncodingException; + + /** + * 转发文章记录 + */ + AjaxResult forwardContent(Long contentId); + + /** + * 获取所有的文章列表 + * @return + */ + AjaxResult getAllContentList(); +} diff --git a/src/main/java/com/jingcheng/cms/shiro/CommonRealm.java b/src/main/java/com/jingcheng/cms/shiro/CommonRealm.java new file mode 100644 index 0000000..098b645 --- /dev/null +++ b/src/main/java/com/jingcheng/cms/shiro/CommonRealm.java @@ -0,0 +1,69 @@ +//package com.bsd.cases.shiro; +// +//import com.bsd.cases.model.BoUsers; +//import com.bsd.cases.service.BoUsersService; +//import JWTUtil; +//import org.apache.shiro.authc.AuthenticationException; +//import org.apache.shiro.authc.AuthenticationInfo; +//import org.apache.shiro.authc.AuthenticationToken; +//import org.apache.shiro.authc.SimpleAuthenticationInfo; +//import org.apache.shiro.authz.AuthorizationInfo; +//import org.apache.shiro.authz.SimpleAuthorizationInfo; +//import org.apache.shiro.realm.AuthorizingRealm; +//import org.apache.shiro.subject.PrincipalCollection; +//import org.springframework.stereotype.Component; +// +//import javax.annotation.Resource; +// +//@Component +//public class CommonRealm extends AuthorizingRealm { +// +// @Resource +// private BoUsersService boUsersService; +// +// /** +// * 大坑!,必须重写此方法,不然Shiro会报错 +// */ +// @Override +// public boolean supports(AuthenticationToken token) { +// return token instanceof JWTToken; +// } +// +// /** +// * 只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的 +// */ +// @Override +// protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { +// +// String key = JWTUtil.getKey(principals.toString()); +// BoUsers boUsers = boUsersService.selectByUserNoOrOpenId(key); +// SimpleAuthorizationInfo simpleAuthorizationInfo = new SimpleAuthorizationInfo(); +//// simpleAuthorizationInfo.addRole(user.getRole().toString()); +//// Set permission = new HashSet<>(Arrays.asList(user.getPermission().split(","))); +// // simpleAuthorizationInfo.addStringPermissions(permission); +// return simpleAuthorizationInfo; +// } +// +// /** +// * 默认使用此方法进行用户名正确与否验证,错误抛出异常即可。 +// */ +// @Override +// protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException { +// +// String token = (String) auth.getCredentials(); +// // 解密获得username,用于和数据库进行对比 +// String key = JWTUtil.getKey(token); +// if (key == null) { +// throw new AuthenticationException("token invalid"); +// } +// +// BoUsers boUsers = boUsersService.selectByUserNoOrOpenId(key); +// if (boUsers == null) { +// throw new AuthenticationException("User didn't existed!"); +// } +// if (!JWTUtil.verify(token, key)) { +// throw new AuthenticationException("Username or password error"); +// } +// return new SimpleAuthenticationInfo(token, token, "common_ream"); +// } +//}