use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore in project OA4MP by ncsa.
the class AbstractConfigurationLoader method getCASP.
protected MultiDSClientApprovalStoreProvider getCASP() {
if (casp == null) {
casp = new MultiDSClientApprovalStoreProvider(cn, isDefaultStoreDisabled(), loggerProvider.get());
final ClientApprovalProvider caProvider = new ClientApprovalProvider();
ClientApproverConverter cp = new ClientApproverConverter(caProvider);
casp.addListener(new DSFSClientApprovalStoreProvider(cn, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getMySQLConnectionPoolProvider(), OA4MPConfigTags.MYSQL_STORE, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getMariaDBConnectionPoolProvider(), OA4MPConfigTags.MARIADB_STORE, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getPgConnectionPoolProvider(), OA4MPConfigTags.POSTGRESQL_STORE, cp));
casp.addListener(new TypedProvider<ClientApprovalStore>(cn, OA4MPConfigTags.MEMORY_STORE, OA4MPConfigTags.CLIENT_APPROVAL_STORE) {
@Override
public Object componentFound(CfgEvent configurationEvent) {
if (checkEvent(configurationEvent)) {
return get();
}
return null;
}
@Override
public ClientApprovalStore get() {
return new ClientApprovalMemoryStore(caProvider);
}
});
}
return casp;
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore in project OA4MP by ncsa.
the class ClientStoreUtil method listAll.
@Override
protected LinkedList<Identifiable> listAll() throws Exception {
say("select the number of the item below:");
ClientApprovalStore cas = getSE().getClientApprovalStore();
Set keys = getStore().keySet();
LinkedList<Identifiable> linkedList = new LinkedList<Identifiable>();
int i = 0;
for (Object key : keys) {
boolean isApproved = false;
ClientApproval ca = (ClientApproval) cas.get(key);
if (ca == null) {
// create a new one
ca = (ClientApproval) cas.create();
ca.setStatus(ClientApproval.Status.NONE);
ca.setApproved(false);
cas.save(ca);
} else {
isApproved = ca.isApproved();
if (isApproved && ca.getStatus() != ClientApproval.Status.APPROVED) {
ca.setStatus(ClientApproval.Status.APPROVED);
}
}
ClientApproval.Status status = ca.getStatus();
String printableStatus = "?";
if (status.equals(ClientApproval.Status.NONE)) {
}
Identifiable x = (Identifiable) getStore().get(key);
linkedList.add(x);
say((i++) + "." + "(" + (isApproved ? "A" : "D") + ") " + x.getIdentifierString());
}
if (linkedList.isEmpty()) {
say("(no entries found)");
}
return linkedList;
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore in project OA4MP by ncsa.
the class OA2ConfigurationLoader method getCASP.
@Override
protected MultiDSClientApprovalStoreProvider getCASP() {
if (casp == null) {
casp = new MultiDSClientApprovalStoreProvider(cn, isDefaultStoreDisabled(), loggerProvider.get());
final ClientApprovalProvider caProvider = new ClientApprovalProvider();
ClientApprovalKeys caKeys = new ClientApprovalKeys();
caKeys.identifier("client_id");
ClientApproverConverter cp = new ClientApproverConverter(caKeys, caProvider);
casp.addListener(new DSFSClientApprovalStoreProvider(cn, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getMySQLConnectionPoolProvider(), OA4MPConfigTags.MYSQL_STORE, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getMariaDBConnectionPoolProvider(), OA4MPConfigTags.MARIADB_STORE, cp));
casp.addListener(new DSSQLClientApprovalStoreProvider(cn, getPgConnectionPoolProvider(), OA4MPConfigTags.POSTGRESQL_STORE, cp));
casp.addListener(new TypedProvider<ClientApprovalStore>(cn, OA4MPConfigTags.MEMORY_STORE, OA4MPConfigTags.CLIENT_APPROVAL_STORE) {
@Override
public Object componentFound(CfgEvent configurationEvent) {
if (checkEvent(configurationEvent)) {
return get();
}
return null;
}
@Override
public ClientApprovalStore get() {
return new ClientApprovalMemoryStore(caProvider);
}
});
}
return casp;
}
use of edu.uiuc.ncsa.security.delegation.server.storage.ClientApprovalStore in project OA4MP by ncsa.
the class ServiceConfigTest method testClientApprovalStoreProvider.
public void testClientApprovalStoreProvider() throws Exception {
ConfigurationNode cn = getConfig("postgresql config");
MultiDSClientApprovalStoreProvider dap = new MultiDSClientApprovalStoreProvider(cn, true, new MyLoggingFacade("test"), null, null);
ClientApproverConverter cp = new ClientApproverConverter(new ClientApprovalProvider());
dap.addListener(new DSFSClientApprovalStoreProvider(cn, cp));
dap.addListener(new DSSQLClientApprovalStoreProvider(cn, new MySQLConnectionPoolProvider("oauth", "oauth"), MYSQL_STORE, cp));
dap.addListener(new DSSQLClientApprovalStoreProvider(cn, new PGConnectionPoolProvider("oauth", "oauth"), POSTGRESQL_STORE, cp));
ClientApprovalStore<ClientApproval> as = (ClientApprovalStore<ClientApproval>) dap.get();
}
Aggregations