12345678910111213141516171819202122232425262728293031323334 |
- package com.yaozhitech.spring5.service;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.yaozhitech.spring5.domain.Client;
- import com.yaozhitech.spring5.domain.ClientAuth;
- import com.yaozhitech.spring5.mapper.ClientAuthMapper;
- import com.yaozhitech.spring5.mapper.ClientMapper;
- @Service
- public class ClientAuthService {
- @Autowired
- private ClientAuthMapper authClientMapper;
-
- @Autowired
- private ClientMapper clientMapper;
-
- public Boolean isAllowed(String service, String allowClient, String secret) {
- Client client = clientMapper.selectOne(new QueryWrapper<Client>().eq("name", allowClient).eq("secret", secret));
- if (client == null) {
- return false;
- }
-
- ClientAuth authClient = authClientMapper.selectOne(new QueryWrapper<ClientAuth>()
- .eq("service", service)
- .eq("allow_client", allowClient));
-
- return authClient != null;
- }
- }
|