Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Modifying 'Require callers to authenticate' for a Service

Avatar

Level 2

Can anyone point me to where this value resides in the API?  I can't seem to find it in the ServiceConfiguration, I also see no relavant options in ModifyServiceConfigurationInfo.  I see m_anonymousAccess in the invoke Ooperation map but the value always seems to be null.

Thanks,

Michael

6 Replies

Avatar

Former Community Member

See http://help.adobe.com/en_US/enterpriseplatform/10.0/programLC/help/index.html

Invoking Document Services Using the Java APIs >

     Setting Connection Properties >

          Using a Context object to invoke Document Services

It contains some sample code.

// Authenticate a user and use the Context object within connection settings

// Authenticate the user

String username = "wblue";

String password = "password";

AuthResult authResult = authClient.authenticate(username, password.getBytes());

// Set a Content object that represents the authenticated user

// Use the Context object to invoke the Encryption service

Context myCtx = new Context();

myCtx.initPrincipal(authResult);

//Set connection settings

Properties connectionProps = new Properties();

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://hiro-xp:1099");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL, ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, ServiceClientFactoryProperties.DSC_JBOSS_SERVER_TYPE);

                       

//Create a ServiceClientFactory object

ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

myFactory.setContext(myCtx);

                       

//Create an EncryptionServiceClient object

EncryptionServiceClient encryptClient  = new EncryptionServiceClient(myFactory);

...

Steve



Avatar

Level 2

Hello Steve,

I appreciate the answer but I'm actually looking to change that actual setting as I want to turn off authentication all together for a couple of very specific services.  In those scenarios I won't have a context at all.

Thanks,

Michael

Avatar

Level 2

Here's a bit of code that I'm hoping to add this logic to once I find where the setting exists:

ConfigParameter[] configParameters = serviceConfiguration.getConfigParameters();

ModifyServiceConfigurationInfo info = new ModifyServiceConfigurationInfo();

info.setServiceId(serviceConfiguration.getServiceId());

info.setMajorVersion(1);

info.setRunAsConfiguration(ServiceConfiguration.RUN_AS_SYSTEM);

serviceRegistry.modifyConfiguration(info);

Avatar

Former Community Member

Hi Michael,

Is there a reason you don't want to simply set the "run as" configuration in the admin UI?

Steve

Avatar

Level 2

I'm trying to automate the lca deployment/configuration as much as possible as I need to deploy this to 5 seperate environments and those settings are always blown away.  The deployment of our dsc's are fully automated with no human interaction, which is quite nice.

Thanks Steve,

Michael

Avatar

Level 1

Please check out the following document for your reference.

Disabling Service Security

http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001127.html

Jason Lee