fixed service
This commit is contained in:
parent
d86dcc3562
commit
50e72b9004
|
@ -1,9 +1,10 @@
|
|||
package com.loafle.overflow.central.module.apikey.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.exception.OverflowException;
|
||||
|
||||
import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO;
|
||||
|
||||
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 9. 29.
|
||||
*/
|
||||
public class DiscoveryStartInfo {
|
||||
String startIp;
|
||||
String endIP;
|
||||
String excludeIp;
|
||||
String startPort;
|
||||
String endPort;
|
||||
List<String> services;
|
||||
|
||||
public String getStartIp() {
|
||||
return startIp;
|
||||
}
|
||||
|
||||
public void setStartIp(String startIp) {
|
||||
this.startIp = startIp;
|
||||
}
|
||||
|
||||
public String getEndIP() {
|
||||
return endIP;
|
||||
}
|
||||
|
||||
public void setEndIP(String endIP) {
|
||||
this.endIP = endIP;
|
||||
}
|
||||
|
||||
public String getExcludeIp() {
|
||||
return excludeIp;
|
||||
}
|
||||
|
||||
public void setExcludeIp(String excludeIp) {
|
||||
this.excludeIp = excludeIp;
|
||||
}
|
||||
|
||||
public String getStartPort() {
|
||||
return startPort;
|
||||
}
|
||||
|
||||
public void setStartPort(String startPort) {
|
||||
this.startPort = startPort;
|
||||
}
|
||||
|
||||
public String getEndPort() {
|
||||
return endPort;
|
||||
}
|
||||
|
||||
public void setEndPort(String endPort) {
|
||||
this.endPort = endPort;
|
||||
}
|
||||
|
||||
public List<String> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(List<String> services) {
|
||||
this.services = services;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ package com.loafle.overflow.central.module.discovery.service;
|
|||
|
||||
import com.loafle.overflow.central.commons.model.SessionMetadata;
|
||||
import com.loafle.overflow.central.commons.service.MessagePublisher;
|
||||
import com.loafle.overflow.central.module.discovery.model.DiscoveryStartInfo;
|
||||
|
||||
import com.loafle.overflow.core.annotation.ProbeAPI;
|
||||
import com.loafle.overflow.core.annotation.WebappAPI;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.type;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 27.
|
||||
*/
|
||||
public enum PortType {
|
||||
TCP("TCP"),
|
||||
UDP("UDP"),
|
||||
TLS("TLS");
|
||||
|
||||
private String stringValue;
|
||||
PortType(String string) {stringValue = string;}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return stringValue;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package com.loafle.overflow.central.module.domain.dao;
|
||||
|
||||
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
|
|
@ -3,9 +3,10 @@ package com.loafle.overflow.central.module.domain.service;
|
|||
import com.loafle.overflow.central.module.domain.dao.DomainMemberDAO;
|
||||
|
||||
import com.loafle.overflow.central.module.member.dao.MemberDAO;
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.service.central.domain.DomainMemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.loafle.overflow.central.module.email.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.email.model.EmailAuth;
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import com.loafle.overflow.model.email.EmailAuth;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package com.loafle.overflow.central.module.email.exception;
|
||||
|
||||
import com.loafle.overflow.central.commons.exception.OverflowRuntimeException;
|
||||
|
||||
/**
|
||||
* Created by geek on 17. 11. 22.
|
||||
*/
|
||||
public class EmailOverAuthException extends OverflowRuntimeException {
|
||||
public EmailOverAuthException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EmailOverAuthException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.loafle.overflow.central.module.email.model;
|
||||
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 22.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "EMAIL_AUTH", schema = "public")
|
||||
public class EmailAuth {
|
||||
private long id;
|
||||
private String emailAuthKey;
|
||||
private Date createDate;
|
||||
private Date authConfirmDate;
|
||||
private Member member;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "EMAIL_AUTH_KEY", nullable = true, length = 50)
|
||||
public String getEmailAuthKey() {
|
||||
return emailAuthKey;
|
||||
}
|
||||
|
||||
public void setEmailAuthKey(String emailAuthKey) {
|
||||
this.emailAuthKey = emailAuthKey;
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "AUTH_CONFIRM_DATE", nullable = true, insertable = true, updatable = true)
|
||||
public Date getAuthConfirmDate() {
|
||||
return authConfirmDate;
|
||||
}
|
||||
|
||||
public void setAuthConfirmDate(Date authConfirmDate) {
|
||||
this.authConfirmDate = authConfirmDate;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "MEMBER_ID", nullable = false)
|
||||
public Member getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public void setMember(Member member) {
|
||||
this.member = member;
|
||||
}
|
||||
}
|
|
@ -1,17 +1,19 @@
|
|||
package com.loafle.overflow.central.module.email.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.model.Mail;
|
||||
|
||||
import com.loafle.overflow.central.commons.utils.EmailSender;
|
||||
import com.loafle.overflow.central.module.domain.dao.DomainDAO;
|
||||
import com.loafle.overflow.central.module.domain.dao.DomainMemberDAO;
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.central.module.domain.model.DomainMember;
|
||||
import com.loafle.overflow.central.module.email.dao.EmailAuthDAO;
|
||||
import com.loafle.overflow.central.module.email.exception.EmailOverAuthException;
|
||||
import com.loafle.overflow.central.module.email.model.EmailAuth;
|
||||
|
||||
import com.loafle.overflow.central.module.member.dao.MemberDAO;
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.core.model.Mail;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import com.loafle.overflow.model.email.EmailAuth;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.model.meta.MetaMemberStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -25,7 +27,7 @@ import java.util.*;
|
|||
* Created by geek on 17. 6. 28.
|
||||
*/
|
||||
@Service("EmailAuthService")
|
||||
public class EmailAuthService {
|
||||
public class CentralEmailAuthService {
|
||||
|
||||
@Autowired
|
||||
private EmailAuthDAO emailAuthDAO;
|
||||
|
@ -77,7 +79,7 @@ public class EmailAuthService {
|
|||
return this.emailAuthDAO.findOne(id);
|
||||
}
|
||||
|
||||
public EmailAuth readByAuthKey(String authKey) throws UnsupportedEncodingException {
|
||||
public EmailAuth readByAuthKey(String authKey) throws OverflowException, UnsupportedEncodingException {
|
||||
System.out.println("authKey = [" + authKey + "]");
|
||||
String deStr = URLDecoder.decode(authKey, "UTF-8");
|
||||
System.out.println("deStr = [" + deStr + "]");
|
||||
|
@ -98,7 +100,7 @@ public class EmailAuthService {
|
|||
Date nowDate = new Date();
|
||||
|
||||
if (!nowDate.before(futureDate)) {
|
||||
throw new EmailOverAuthException("The authentication expiration time has passed.");
|
||||
throw new OverflowException("The authentication expiration time has passed.", new Throwable());
|
||||
}
|
||||
|
||||
auth.setAuthConfirmDate(new Date());
|
|
@ -1,9 +1,12 @@
|
|||
package com.loafle.overflow.central.module.apikey.service;
|
||||
|
||||
import com.google.protobuf.Api;
|
||||
import com.loafle.overflow.central.module.apikey.model.ApiKey;
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -58,7 +61,7 @@ public class ApiKeyServiceTest {
|
|||
|
||||
@Ignore
|
||||
@Test
|
||||
public void findByDomain() {
|
||||
public void findByDomain() throws OverflowException {
|
||||
|
||||
Domain domain = new Domain();
|
||||
domain.setId(1);
|
||||
|
@ -70,7 +73,7 @@ public class ApiKeyServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readByApiKey() {
|
||||
public void readByApiKey() throws OverflowException {
|
||||
|
||||
ApiKey apiKey = this.apiKeyService.readByApiKey("52abd6fd57e511e7ac52080027658d13");
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.loafle.overflow.central.module.auth.service;
|
||||
|
||||
import com.loafle.overflow.central.module.auth.model.AuthCrawler;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.central.module.target.model.Target;
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||
import com.loafle.overflow.model.meta.MetaCrawler;
|
||||
import com.loafle.overflow.model.target.Target;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -19,7 +20,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||
public class AuthCrawlerServiceTest {
|
||||
|
||||
@Autowired
|
||||
private AuthCrawlerService authCrawlerService;
|
||||
private CentralAuthCrawlerService authCrawlerService;
|
||||
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
@ -47,7 +48,7 @@ public class AuthCrawlerServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void findAuth() {
|
||||
public void findAuth() throws OverflowException {
|
||||
|
||||
MetaCrawler metaCrawler = new MetaCrawler();
|
||||
metaCrawler.setId((short)23);
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.loafle.overflow.central.module.domain.service;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.central.module.domain.model.DomainMember;
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.service.central.domain.DomainMemberService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -48,7 +51,7 @@ public class DomainMemberServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void readAllMemberByDomain() {
|
||||
public void readAllMemberByDomain() throws OverflowException {
|
||||
|
||||
Domain domain = new Domain();
|
||||
domain.setId(1);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.loafle.overflow.central.module.domain.service;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
@ -20,7 +21,7 @@ import static org.junit.Assert.*;
|
|||
public class DomainServiceTest {
|
||||
|
||||
@Autowired
|
||||
private DomainService domainService;
|
||||
private CentralDomainService domainService;
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.loafle.overflow.central.module.email.service;
|
||||
|
||||
import com.loafle.overflow.central.module.email.model.EmailAuth;
|
||||
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import com.loafle.overflow.model.email.EmailAuth;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -22,7 +23,7 @@ import java.util.Date;
|
|||
public class EmailAuthServiceTest {
|
||||
|
||||
@Autowired
|
||||
EmailAuthService emailAuthService;
|
||||
CentralEmailAuthService emailAuthService;
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
|
|
Loading…
Reference in New Issue
Block a user