001package co.codewizards.cloudstore.ls.rest.server.auth;
002
003import java.util.Arrays;
004
005import co.codewizards.cloudstore.core.util.PasswordUtil;
006
007// TODO implement changing passwords - sth. similar to TransientRepoPasswordManager
008public class AuthManager {
009
010        private final char[] password = PasswordUtil.createRandomPassword(25);
011
012        protected AuthManager() { }
013
014        private static final class Holder {
015                public static final AuthManager instance = new AuthManager();
016        }
017
018        public static AuthManager getInstance() {
019                return Holder.instance;
020        }
021
022        public char[] getCurrentPassword() {
023                return password;
024        }
025
026        public boolean isPasswordValid(char[] password) {
027                return Arrays.equals(this.password, password);
028        }
029}