diff --git a/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java b/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java index e7291b8..9efa708 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java @@ -1,4 +1,39 @@ package org.ntlab.citrusserver.repositories; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; +import org.ntlab.citrusserver.entities.Account; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Repository; + +import java.lang.reflect.Array; +import java.util.*; + +import java.util.HashMap; + +@Repository public class AccountManager { + private HashMap accounts = new HashMap(); + + private HashMap accountToken = new HashMap<>(); //keyがaccountId,valueがtoken + + // アカウントの一覧をリストとして返す + public Set getAccountsID() { + return accounts.keySet(); + } + + // account_idとpasswordを設定し新しいアカウントを作成する + public String newAccount(String accountId, String password) { + UUID str = UUID.randomUUID(); + String token = str.toString(); + //accounts.setId(accountId); + //accounts.setPassword(password); + accountToken.put(accountId, token); //accountIDとtokenをHashMapに入れる + return token; + } + + // 指定されたアカウントの情報を返す + public Account getAccount(String accountId) { + return accounts.get(accountId); + } }