001package co.codewizards.cloudstore.rest.server.auth;
002
003import static co.codewizards.cloudstore.core.util.Util.assertNotNull;
004
005import java.util.UUID;
006
007import co.codewizards.cloudstore.core.auth.AuthToken;
008
009public class TransientRepoPassword {
010
011        private final UUID serverRepositoryId;
012        private final UUID clientRepositoryId;
013        private final AuthToken authToken;
014        private final char[] password;
015
016        protected TransientRepoPassword(UUID serverRepositoryId, UUID clientRepositoryId, AuthToken authToken) {
017                this.serverRepositoryId = assertNotNull("serverRepositoryId", serverRepositoryId);
018                this.clientRepositoryId = assertNotNull("clientRepositoryId", clientRepositoryId);
019                this.authToken = assertNotNull("authToken", authToken);
020                authToken.makeUnmodifiable();
021                assertNotNull("authToken.expiryDateTime", authToken.getExpiryDateTime());
022                assertNotNull("authToken.password", authToken.getPassword());
023                this.password = authToken.getPassword().toCharArray();
024        }
025
026        public UUID getServerRepositoryId() {
027                return serverRepositoryId;
028        }
029        public UUID getClientRepositoryId() {
030                return clientRepositoryId;
031        }
032        public AuthToken getAuthToken() {
033                return authToken;
034        }
035        public char[] getPassword() {
036                return password;
037        }
038}