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