da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * The contents of this file are subject to the terms of the Common Development and
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * Distribution License (the License). You may not use this file except in compliance with the
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * specific language governing permission and limitations under the License.
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * When distributing Covered Software, include this CDDL Header Notice in each file and include
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * Header, with the fields enclosed by brackets [] replaced by your own identifying
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * information: "Portions copyright [year] [name of copyright owner]".
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs * Copyright 2015 ForgeRock AS.
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacsstatic void install_log(const char *format, ...) {
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs FILE *f = fopen("c:\\windows\\temp\\test.log", "a+");
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs strftime(ts, sizeof (ts) - 1, "%Y-%m-%d %H:%M:%S", &now);
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs const char *openam_url = "https://am.example.com:443/am";
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs memset(&net_options, 0, sizeof (am_net_options_t));
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs net_options.keepalive = net_options.local = net_options.cert_trust = AM_TRUE;
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs rv = am_url_validate(0, openam_url, &net_options, &httpcode);
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs fprintf(stderr, "STATUS: %s\n", am_strerror(rv));
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs fprintf(stderr, "HTTP STATUS: %d\n", httpcode);
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs const char *openam_url = "https://am.example.com:443/am";
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs memset(&net_options, 0, sizeof (am_net_options_t));
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs net_options.keepalive = net_options.local = net_options.cert_trust = AM_TRUE;
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs rv = am_agent_login(0, openam_url, agent_user, agent_password, agent_realm, &net_options,
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs fprintf(stderr, "LOGIN STATUS: %s\n", am_strerror(rv));
219d7da202ac0880b886d6d5948844dd40f5a1d5Mareks Malnacs rv = am_agent_logout(0, openam_url, agent_token, &net_options);
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs fprintf(stderr, "LOGOUT STATUS: %s\n", am_strerror(rv));
da770c2324ca473ff5cf479d2960b05a284493d4Mareks Malnacs fprintf(stderr, "TOKEN: %s\n", LOGEMPTY(agent_token));