I want to create an agent object using siteminder r.12. Want to find the values for the below parameters. Where is the value stored?
User-defined connection parameters defined in your codeāfor example:
AgentAPI agent = new AgentAPI();
ServerDef sd = new ServerDef();
sd.serverIpAddress = POLICY_IP;
sd.connectionMin = CX_MIN;
sd.connectionMax = CX_MAX;
sd.connectionStep = CX_STEP;
sd.timeout = CX_TIMEOUT;
sd.authorizationPort = AZ_PORT;
sd.authenticationPort = AUTH_PORT;
sd.accountingPort = ACC_PORT;
InitDef init=new InitDef(AGENT_LOGIN,SHARED_SECRET,false, sd);
agent.init(init);
Thanks,
navi
To use the AgentApi you will need to know some things about your Policy Server and agent. You will have to find the host address of the Policy Server, the agent name you will use to query the PS, the authorization port and authentication port and the shared secret.
Go here for the spec of the AgentApi:
https://support.ca.com/cadocs/0/CA%20SiteMinder%2012%2052-ENU/Bookshelf_Files/programming-reference/legacy-sm-java-sdk/netegrity/siteminder/javaagent/AgentAPI.html
the parameters you are looking for are related to Host Configuration Object (HCO) and SmHost.conf settings.
Related
Running Wildfly as Azure App Service was possible via a custom java app [https://azure.microsoft.com/en-us/documentation/articles/web-sites-java-custom-upload/]. However, app service nodes don't know the internal IP address while registering with JGroups. They always expose 127.0.0.1. In order to make JGroups cluster members communicate, we need a well known IP address of the node.
How can Wildfly determine the internal IP address of the host that it can use to register with JGroups cluster?
Per my experience, I think you can try to use Azure SDK for Java to get the internal IP address of the host from the WebSiteManagementClient.
Here is a sample code below for getting the internal IP address.
String userName = "<user-name>";
String password = "<password>";
String resourceGroupName = "<resource-group-name>";
String name = "<webapp-name>";
ServiceClientCredentials credentials = new BasicAuthenticationCredentials(userName, password);
WebSiteManagementClient webSiteManagementClient = new WebSiteManagementClientImpl(credentials);
HostingEnvironmentsOperations hostingEnvironmentsOperations = webSiteManagementClient.getHostingEnvironmentsOperations();
ServiceResponse<AddressResponse> serviceResponse = hostingEnvironmentsOperations.getHostingEnvironmentVips(resourceGroupName, name);
AddressResponse addressResponse = (AddressResponse) serviceResponse.getBody();
String internalIp = addressResponse.getInternalIpAddress();
To run the above sample, you need to add the dependent libraries into your Maven project, please see the dependencies below.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-websites</artifactId>
<version>0.9.2</version>
</dependency>
More details for the key classes in the above sample code, please see below.
WebSiteManagementClient & WebSiteManagementClientImpl
HostingEnvironmentsOperations
AddressResponse
You could use a special keyword for the bind_addr, see [1] for details. E.g. bind_addr=match-address:192.168.1.* to try to pick an IP address on a given subnet.
[1] http://www.jgroups.org/manual/index.html#Transport
You could use Peter's code (above) to detect the available IP addresses, then set bind_addr in JGroups, e.g. like this:
InetAddress bind_addr; // detect address by using Azure's SDK
JChannel ch=new JChannel("config.xml");
TP transport=ch.getProtocolStack().getTransport();
transport.setBindAddress(bind_addr);
ch.connect("mycluster");
The important thing is that you need to set the bind address before connecting the channel.
Using fiddler as a HTTP proxy, i connect to a local CometD server.
I inherit the class DefaultSecurityPolicy, and got the client's IP address with server.getContext().getRemoteAddress().getAddress().getHostAddress() in canHandshake Method.
However, it returns the client's real IP (original IP), but what i want is the one directly communicates with the server. Any help?
If the client using WebSocket to communicate with CometD server, The HTTP proxy doesn't take effect at all, So what i got is the original addr, am i right?
public function getlocationFromIp()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
// Check if using Shared Internet Environment
$ipAddress = $_SERVER['HTTP_CLIENT_IP'];
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
// Check if using Proxy User
$ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ipAddress = $_SERVER['REMOTE_ADDR'];
}
$ip_geo_url = 'http://freegeoip.net/json/'.$ipAddress;
$ip_json = file_get_contents($ip_geo_url);
$ip_json = json_decode($ip_json);
return $ip_json;
}
it will get the location whit ip if it help you ...
it will be get the proxy location too
I'm currently looking into settings up a client/server application using Akka remote actors to communicate. As a part of that setup, I would like to enable the build-in ssl mode, which is supported through netty.
However I'm not entirely sure on how to exactly set the parameters, even though I have tried a number of different combinations.
I have used http://doc.akka.io/docs/akka/2.2.0/java/remoting.html for reference on the different parameters.
Regarding creating keystore and truststore I have used the guide in this link:
http://www.ibm.com/developerworks/library/j-customssl/sidebar.html
The relevant part of my configuration looks like this on the client:
remote {
enabled-transports = ["akka.remote.netty.ssl"]
netty.ssl {
host = ""
port = 0
enable-ssl = true
}
netty.ssl.security {
key-store = "ServiceTesterClientKeys"
trust-store = "clientTrust"
key-store-password = "XX"
key-password = "XX"
trust-store-password = "YY"
protocol = "TLSv1"
random-number-generator = "AES128CounterSecureRNG"
enabled-algorithms = [TLS_RSA_WITH_AES_128_CBC_SHA]
}
}
and like this on the server:
remote {
enabled-transports = ["akka.remote.netty.ssl"]
netty.ssl {
hostname = ""
port = 2562
enable-ssl = true
}
netty.ssl.security {
key-store = "serverKeys"
trust-store = "serverTrust"
key-store-password = "YY"
key-password = "YY"
trust-store-password = "XX"
protocol = "TLSv1"
random-number-generator = "AES128CounterSecureRNG"
enabled-algorithms = [TLS_RSA_WITH_AES_128_CBC_SHA]
}
}
Do I need to add the properties or can Akka find it as long as it's on the classpath?
-Djavax.net.ssl.keyStore=A
-Djavax.net.ssl.trustStore=B
At runtime I get a long stack, but in the beginning it says:
[MySystem-akka.actor.default-dispatcher-11] ERROR akka.remote.EndpointWriter - AssociationError [akka.ssl.tcp://MySystem#10.195.20.11:10693] -> [akka.ssl.tcp://MyServerSystem#localhost:2562]: Error [Association failed with [akka.ssl.tcp://MyServerSystem#localhost:2562]] [
akka.remote.EndpointAssociationException: Association failed with [akka.ssl.tcp://MyServerSystem#localhost:2562]
Caused by: akka.remote.transport.netty.NettyTransport$$anonfun$associate$1$$anon$2: Failed to initialize a pipeline.
Caused by: akka.remote.RemoteTransportException: Client SSL connection could not be established because SSL context could not be constructed.
Help would be very much appreciated.
Regards Stefan
Okay, I have looked further into the issue.
The problem was related to the random-number-generator = "AES128CounterSecureRNG" property.
Instead I have choosen to use the default implementation.
I guess I will need to add the provider, if I want to use this implementation.
For those who looked thanks for your time.
Using Documentum DFC, I would like to set up a docbase connection without using a dmcl.ini.
How can I do such a thing?
You can inject docbroker data into the DFC with Java like this :
IDfClient client = new DfClient()
IDfTypedObject config = client.getClientConfig();
config.setString("primary_host", <docbroker adress>);
config.setInt("primary_port", <docbroker port>);
IDfSessionManager manager = client.newSessionManager();
//use manager like usual
Hi I want to write a java program where I will provide my email id and password. and I want to read all new unread messages that arrived to that email id. I donot know how to write program for that.
The below program works fine for gmail. but it does not work for yahoomail because for yahoo pop3 is not configured. I want a generic code which will work for all email id.
import java.io.*;
import java.util.*;
import javax.mail.*;
public class ReadMail {
public static void main(String args[]) throws Exception {
// String host = "pop.gmail.com";
// String user = "xyz";
// String password = "12345";
// Get system properties
Properties properties = System.getProperties();
// Get the default Session object.
Session session = Session.getDefaultInstance(properties, null);
// Get a Store object that implements the specified protocol.
Store store = session.getStore("pop3s");
//Connect to the current host using the specified username and password.
store.connect(host, user, password);
//Create a Folder object corresponding to the given name.
Folder folder = store.getFolder("inbox");
// Open the Folder.
folder.open(Folder.READ_ONLY);
Message[] message = folder.getMessages();
// Display message.
for (int i = 0; i < message.length; i++) {
System.out.println("------------ Message " + (i + 1) + " ------------");
System.out.println("SentDate : " + message[i].getSentDate());
System.out.println("From : " + message[i].getFrom()[0]);
System.out.println("Subject : " + message[i].getSubject());
System.out.print("Message : ");
InputStream stream = message[i].getInputStream();
while (stream.available() != 0) {
System.out.print((char) stream.read());
}
System.out.println();
}
folder.close(true);
store.close();
}
}
You need to know more than just login-pass. Things like mail server address, mail server type, port for connections, etc.
You should probably check out Java Mail API, or Commons Email.
UPD:
You create a Session using Session.getDefaultInstance() method (which takes connection Properties object and authenticator), get a Store from this Session using Session.getStore() method, get a Folder from that store using Store.getFolder("FOLDER_NAME") method, open that Folder, using Folder.open(Folder.READ) method, and get all messages, using something like Message[] messages = inboxFolder.getMessages();
Is that what you were looking for?
UPD2:
There is simply no way to write a generic program, which will work with any mail provider, using just server path, userID and password. Because different mail servers are configured differently. They talk differen protocols (imap/pop3/pop3 ssl) on different ports. There's always some guy, who has configured his mail server to talk imap over ssl on 31337 port only, all the other ports and protocols are banned. And this guy breaks your program. So, you'll have to specify all this properties in your properties object. Look here for properties, you'll have to specify.
UPD3:
On second thought, you actually have one option. Just try connecting to the server using different protocols. If that does not help, start iterating through ports. The one that fits is your configuration. If that's really what you want.
You need the javax.mail package, and the documentation of it. Read the documentation. Then you know.
There are two ways to do it:
1) Google provides API's to access mail you could use that library which provides more control over your mails. See here: http://code.google.com/apis/gmail/. In the same way try for other email providers.
2) Simple mail client(you could find it easily googling), but you need to look at headers to identify which mails are read/unread etc.
You need a registry where you can get the properties for a given mail service.
For instance, instead of specifying a pop3 host, you could specify the name of a .properties file that would contain the host, the port, the protocol, etc...
If your .properties file contains the protocol, for instance mail.store.protocol=pop3, you could use session.getStore() (with no argument), and the same code could be used for pop3, imap, pop3s, imaps.