saml-client icon indicating copy to clipboard operation
saml-client copied to clipboard

unable to get required help to accomplish SLO with okta

Open gtiwari2015 opened this issue 2 years ago • 0 comments

unable to use SLO, how to direct request to SLO url

i am trying to saml-client to SP initiated logout with okta , i am able to use SSO login with okta. but i need guidance on how to proceed

public String sendSAMLRequest(String loggedinUser) throws SamlException, FileNotFoundException { String publicKeyPath = "cert.x509.pem"; String privateKeyPath = "private.pk8"; final String fileSeparator = System.getProperty("file.separator"); final File file = PathUtils.getTempFile(getServerPath(), "metadata", ".xml"); final File directory = FileUtils.getFile(getServerPath(), "WEB-INF" + fileSeparator + "classes"); final File metadatafile = new File(directory + fileSeparator + SamlReportAuditFactory.FILE_NAME); FileReader fileReader = new FileReader(metadatafile); SamlClient client = SamlClient.fromMetadata("http://www.okta.com/jlsdjflsjdflsjjlfjlsj", "https://localhost:8443/myapp/rest/sp/consumer", fileReader);

    final File privateKeyFile = new File(directory + fileSeparator + privateKeyPath);

    final File publicKeyFile  = new File(directory + fileSeparator + publicKeyPath);
    client.setSPKeys(publicKeyFile.getAbsolutePath(),privateKeyFile.getAbsolutePath());
    String encodedRequest = client.getLogoutRequest(loggedinUser);
 
    return encodedRequest;
 
}

gtiwari2015 avatar Nov 16 '22 13:11 gtiwari2015