Added license

This commit is contained in:
Dave
2014-12-21 00:13:27 +02:00
parent 335b20ac69
commit bce0155abe
31 changed files with 746 additions and 59 deletions

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoConfig is a means to store the server secret key, database address
* and other configs.
*/
package nodash.core;
import java.io.ByteArrayInputStream;

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoCore class is the interface between which the wrapper application
* (wrapplication?) accesses no- functionality.
*/
package nodash.core;
import java.io.File;
@@ -6,7 +25,7 @@ import java.security.PublicKey;
import nodash.core.spheres.NoByteSetSphere;
import nodash.core.spheres.NoHashSphere;
import nodash.core.spheres.NoSessionSphere;
import nodash.exceptions.NoDashSessionBadUUID;
import nodash.exceptions.NoDashSessionBadUUIDException;
import nodash.exceptions.NoSessionAlreadyAwaitingConfirmationException;
import nodash.exceptions.NoSessionConfirmedException;
import nodash.exceptions.NoSessionExpiredException;
@@ -43,24 +62,24 @@ public final class NoCore {
return NoSessionSphere.registerUser(user, password);
}
public static NoUser getUser(byte[] cookie) throws NoSessionExpiredException, NoSessionConfirmedException, NoDashSessionBadUUID {
public static NoUser getUser(byte[] cookie) throws NoSessionExpiredException, NoSessionConfirmedException, NoDashSessionBadUUIDException {
/* Facilitates step 3
* allow website-side modifications to the NoUser or NoUser inheritant */
return NoSessionSphere.getUser(cookie);
}
public static NoState getSessionState(byte[] cookie) throws NoSessionExpiredException, NoSessionConfirmedException, NoDashSessionBadUUID {
public static NoState getSessionState(byte[] cookie) throws NoSessionExpiredException, NoSessionConfirmedException, NoDashSessionBadUUIDException {
/* Facilitates step 3
* allow front-side to keep track of session state */
return NoSessionSphere.getState(cookie);
}
public static byte[] requestSave(byte[] cookie, char[] password) throws NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotChangedException, NoSessionAlreadyAwaitingConfirmationException, NoDashSessionBadUUID {
public static byte[] requestSave(byte[] cookie, char[] password) throws NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotChangedException, NoSessionAlreadyAwaitingConfirmationException, NoDashSessionBadUUIDException {
/* Step 4. Provides a user with the new binary file */
return NoSessionSphere.save(cookie, password);
}
public static void confirm(byte[] cookie, char[] password, byte[] data) throws NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotAwaitingConfirmationException, NoUserNotValidException, NoDashSessionBadUUID {
public static void confirm(byte[] cookie, char[] password, byte[] data) throws NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotAwaitingConfirmationException, NoUserNotValidException, NoDashSessionBadUUIDException {
/* Step 5. Assumes the user has re-uploaded the file along with providing the same password.
* Further attempts of getUser or getSessionState will fail with a NoSessionExpiredException*/
NoSessionSphere.confirm(cookie, password, data);

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoRegister class is a simple model used to return both cookies and
* download data upon user registration.
*/
package nodash.core;
public final class NoRegister {

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoUtil class encapsulates no- standard functions such as encryption/decryption
* and hashing algorithms.
*/
package nodash.core;
import java.security.InvalidKeyException;

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoByteSetSphere stores user-to-user influences and their encryption
* keys in an accessible manner.
*/
package nodash.core.spheres;
import java.security.PublicKey;

View File

@@ -1,3 +1,21 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoHashSpehre stores database hashes for user verification.
*/
package nodash.core.spheres;
import java.io.ByteArrayInputStream;

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* The NoSessionSphere stores user sessions and allows their access and
* manipulation with the use of their UUID.
*/
package nodash.core.spheres;
import java.util.Collections;
@@ -8,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
import nodash.core.NoRegister;
import nodash.exceptions.NoByteSetBadDecryptionException;
import nodash.exceptions.NoDashFatalException;
import nodash.exceptions.NoDashSessionBadUUID;
import nodash.exceptions.NoDashSessionBadUUIDException;
import nodash.exceptions.NoSessionAlreadyAwaitingConfirmationException;
import nodash.exceptions.NoSessionConfirmedException;
import nodash.exceptions.NoSessionExpiredException;
@@ -41,7 +60,7 @@ public final class NoSessionSphere {
NoSessionSphere.sessions.remove(uuid);
session = null;
}
} catch (NoDashSessionBadUUID e) {
} catch (NoDashSessionBadUUIDException e) {
// Suppress, doesn't matter
}
}
@@ -96,7 +115,7 @@ public final class NoSessionSphere {
return session.getEncryptedUUID();
}
public static NoUser getUser(byte[] encryptedUUID) throws NoDashSessionBadUUID, NoSessionExpiredException, NoSessionConfirmedException {
public static NoUser getUser(byte[] encryptedUUID) throws NoDashSessionBadUUIDException, NoSessionExpiredException, NoSessionConfirmedException {
UUID uuid = NoSession.decryptUUID(encryptedUUID);
if (NoSessionSphere.sessions.containsKey(uuid)) {
NoSessionSphere.pruneSingle(uuid);
@@ -105,7 +124,7 @@ public final class NoSessionSphere {
throw new NoSessionExpiredException();
}
public static NoState getState(byte[] encryptedUUID) throws NoDashSessionBadUUID, NoSessionExpiredException, NoSessionConfirmedException {
public static NoState getState(byte[] encryptedUUID) throws NoDashSessionBadUUIDException, NoSessionExpiredException, NoSessionConfirmedException {
UUID uuid = NoSession.decryptUUID(encryptedUUID);
if (NoSessionSphere.sessions.containsKey(uuid)) {
NoSessionSphere.pruneSingle(uuid);
@@ -115,7 +134,7 @@ public final class NoSessionSphere {
throw new NoSessionExpiredException();
}
public static synchronized byte[] save(byte[] encryptedUUID, char[] password) throws NoDashSessionBadUUID, NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotChangedException, NoSessionAlreadyAwaitingConfirmationException {
public static synchronized byte[] save(byte[] encryptedUUID, char[] password) throws NoDashSessionBadUUIDException, NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotChangedException, NoSessionAlreadyAwaitingConfirmationException {
UUID uuid = NoSession.decryptUUID(encryptedUUID);
if (NoSessionSphere.sessions.containsKey(uuid)) {
NoSessionSphere.pruneSingle(uuid);
@@ -131,7 +150,7 @@ public final class NoSessionSphere {
throw new NoSessionExpiredException();
}
public static synchronized void confirm(byte[] encryptedUUID, char[] password, byte[] data) throws NoDashSessionBadUUID, NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotAwaitingConfirmationException, NoUserNotValidException {
public static synchronized void confirm(byte[] encryptedUUID, char[] password, byte[] data) throws NoDashSessionBadUUIDException, NoSessionExpiredException, NoSessionConfirmedException, NoSessionNotAwaitingConfirmationException, NoUserNotValidException {
UUID uuid = NoSession.decryptUUID(encryptedUUID);
if (NoSessionSphere.sessions.containsKey(uuid)) {
NoSessionSphere.pruneSingle(uuid);
@@ -149,7 +168,7 @@ public final class NoSessionSphere {
result.cookie = session.getEncryptedUUID();
try {
result.data = NoSessionSphere.save(result.cookie, password);
} catch (NoDashSessionBadUUID e) {
} catch (NoDashSessionBadUUIDException e) {
throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.");
} catch (NoSessionExpiredException e) {
throw new NoDashFatalException("Session expired before it was even returned to client.");