Browse Source

auth key 중복 체크

master
노승철 2 years ago
parent
commit
51f7ea0c5e
  1. 19
      src/main/java/com/palnet/comn/collection/AuthCollection.java

19
src/main/java/com/palnet/comn/collection/AuthCollection.java

@ -1,16 +1,17 @@
package com.palnet.comn.collection; package com.palnet.comn.collection;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.*;
import java.util.List;
@Slf4j
public class AuthCollection { public class AuthCollection {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
private static List<String> authkeyList = new ArrayList<String>(); private static Set<String> authkeyList = new HashSet<>() {};
public void reloadAuthkey() { public void reloadAuthkey() {
// 인증키 하드코딩 처리 // 인증키 하드코딩 처리
@ -22,11 +23,13 @@ public class AuthCollection {
public boolean checkAuthkey(String authKey) { public boolean checkAuthkey(String authKey) {
boolean result = false; boolean result = false;
// logger.debug("authKey ::: " + authKey);
// Iterator<String> keys = authkeyList.iterator();
for(String key : authkeyList) {
// logger.debug("key ::: " + key); for (Iterator<String> iterator = authkeyList.iterator(); iterator.hasNext();) {
if(authKey.equals(key)) { String item = iterator.next();
if(authKey.equals(item)) {
result = true; result = true;
} }
} }

Loading…
Cancel
Save