working on key management
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -12,6 +12,7 @@ dependencies {
|
||||
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
implementation 'org.json:json:20240303'
|
||||
implementation 'org.bitbucket.b_c:jose4j:0.9.6'
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -17,8 +17,10 @@ public class Constants {
|
||||
public static final String GRANT_TYPE = "grant_type";
|
||||
public static final String ID_TOKEN = "id_token";
|
||||
public static final String NAME = "name";
|
||||
public static final String OPENID = "openid";
|
||||
public static final String REDIRECT_URI = "redirect_uri";
|
||||
public static final String REDIRECT_URIS = "redirect_uris";
|
||||
public static final String SCOPE = "scope";
|
||||
public static final String SECRET = "secret";
|
||||
public static final String STATE = "state";
|
||||
public static final String TOKEN_TYPE = "token_type";
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/* © SRSoftware 2024 */
|
||||
package de.srsoftware.oidc.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.jose4j.jwk.PublicJsonWebKey;
|
||||
|
||||
|
||||
public interface KeyManager {
|
||||
public class KeyCreationException extends Exception {
|
||||
public KeyCreationException(Exception cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
public PublicJsonWebKey getKey() throws KeyCreationException, IOException;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/* © SRSoftware 2024 */
|
||||
package de.srsoftware.oidc.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.jose4j.jwk.PublicJsonWebKey;
|
||||
|
||||
public interface KeyStorage {
|
||||
public KeyStorage drop(String keyId);
|
||||
public List<String> listKeys();
|
||||
public PublicJsonWebKey load(String keyId) throws IOException, KeyManager.KeyCreationException;
|
||||
public KeyStorage store(PublicJsonWebKey jsonWebKey) throws IOException;
|
||||
}
|
||||
@@ -43,15 +43,15 @@ public abstract class PathHandler implements HttpHandler {
|
||||
}
|
||||
|
||||
public boolean doDelete(String path, HttpExchange ex) throws IOException {
|
||||
return false;
|
||||
return notFound(ex);
|
||||
}
|
||||
|
||||
public boolean doGet(String path, HttpExchange ex) throws IOException {
|
||||
return false;
|
||||
return notFound(ex);
|
||||
}
|
||||
|
||||
public boolean doPost(String path, HttpExchange ex) throws IOException {
|
||||
return false;
|
||||
return notFound(ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,7 +112,7 @@ public abstract class PathHandler implements HttpHandler {
|
||||
}
|
||||
|
||||
public static boolean notFound(HttpExchange ex) throws IOException {
|
||||
LOG.log(WARNING, "not implemented");
|
||||
LOG.log(ERROR, "not implemented");
|
||||
return sendEmptyResponse(HTTP_NOT_FOUND, ex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user