Skip to content

Instantly share code, notes, and snippets.

View ilgrosso's full-sized avatar

Francesco Chicchiriccò ilgrosso

View GitHub Profile
@ilgrosso
ilgrosso / Olingo4V3FunctionImportInvoke.java
Last active August 29, 2015 13:58
Invoking V3 FunctionImport via Olingo4 client library
Edm edm = getClient().getRetrieveRequestFactory().
getMetadataRequest(testStaticServiceRootURL).execute().getBody();
EdmFunction func = edm.getUnboundFunction("GetPrimitiveString", null);
EdmEntityContainer container = edm.getSchemas().get(0).getEntityContainer();
URIBuilder builder = getClient().getURIBuilder(testStaticServiceRootURL).
appendOperationCallSegment(URIUtils.operationImportURISegment(container, func.getName()));
ODataProperty property = getClient().getInvokeRequestFactory().

Keybase proof

I hereby claim:

  • I am ilgrosso on github.
  • I am ilgrosso (https://keybase.io/ilgrosso) on keybase.
  • I have a public key whose fingerprint is 6F62 BD06 FCE8 4D77 4248 4EBC 6B43 13ED 273D F287

To claim this, I am signing this object:

set 04, 2015 4:14:03 PM org.apache.cxf.interceptor.LoggingOutInterceptor
INFORMAZIONI: Outbound Message
---------------------------
ID: 1
Address: http://localhost:9080/syncope/rest/policies
Http-Method: POST
Content-Type: application/json
Headers: {Content-Type=[application/json], Accept=[application/json], Authorization=[Basic YWRtaW46cGFzc3dvcmQ=]}
Payload: {"@class":"org.apache.syncope.common.lib.policy.AccountPolicyTO","key":0,"description":"Account Policy with custom rules","type":"ACCOUNT","propagateSuspension":false,"maxAuthenticationAttempts":0,"usedByResources":[],"usedByRealms":[],"ruleConfs":[{"@class":"net.tirasa.blog.ilgrosso.syncopecustompolicyrules.common.CustomAccountRuleConf","name":"net.tirasa.blog.ilgrosso.syncopecustompolicyrules.common.CustomAccountRuleConf","requiredSubString":"tralallallero"}],"resources":[]}
--------------------------------------
@ilgrosso
ilgrosso / DecodeGuardedString.java
Created August 30, 2013 12:26
Briefly shows how to get the actual clear-text password out of a ConnId's GuardedString
// encrypted password is in encPwd
GuardedString encPwd = ...;
final StringBuilder clearPwd = new StringBuilder();
encPwd.access(new GuardedString.Accessor() {
@Override
public void access(final char[] clearChars) {
clearPwd.append(clearChars);
@ilgrosso
ilgrosso / ODataJClient4_EntityRetrieve.java
Last active January 4, 2016 20:29
ODataJClient4: EntityRetrieve
ODataClient client = ODataClientFactory.getV3(); // or ODataClientFactory.getV4();
String serviceRoot = ...;
URIBuilder uriBuilder = client.getURIBuilder(serviceRoot).
appendEntityTypeSegment("Customer").appendKeySegment(-10).expand("Info");
// long version (using ATOM)
ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
ODataRetrieveResponse<ODataEntity> res = req.execute();
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.commons.collections4.list.SetUniqueList;
// Given this user...
UserTO userTO = ...
List<String> groupKeys = SetUniqueList.setUniqueList(new ArrayList<String>());
// First statically assigned groups...
package org.apache.syncope.core.provisioning.java.pushpull;
import javax.script.Bindings;
import javax.script.Invocable;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import javax.script.SimpleBindings;
import org.apache.syncope.common.lib.patch.AnyPatch;
import org.apache.syncope.common.lib.to.AnyTO;
List<PullActions> actions = new ArrayList<>();
for (String className : pullTask.getActionsClassNames()) {
try {
PullActions pullActions;
if (className.indexOf('.') == -1) {
ExtensionScript script = null; // suppose to fetch it using className as key
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
engine.eval(new InputStreamReader(script.getContent()));
@ilgrosso
ilgrosso / WicketPlugin.java
Created July 16, 2018 11:49
Hotswap: tentative Wicket plugin
import java.lang.reflect.Method;
import org.hotswap.agent.annotation.Init;
import org.hotswap.agent.annotation.OnClassLoadEvent;
import org.hotswap.agent.annotation.OnResourceFileEvent;
import org.hotswap.agent.annotation.Plugin;
import org.hotswap.agent.command.Scheduler;
import org.hotswap.agent.javassist.CannotCompileException;
import org.hotswap.agent.javassist.CtClass;
import org.hotswap.agent.javassist.NotFoundException;
import org.hotswap.agent.logging.AgentLogger;
@ilgrosso
ilgrosso / FirefoxOnDocker.md
Last active August 16, 2019 12:27
Firefox on Docker