Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example documentation #3

Open
andrew-boutin opened this issue Jul 18, 2017 · 4 comments
Open

Example documentation #3

andrew-boutin opened this issue Jul 18, 2017 · 4 comments
Assignees

Comments

@andrew-boutin
Copy link

Do you have any example code snippets or documentation? I was hoping to see something similar to the README from https://github.com/pac4j/spring-security-pac4j.

@jkacer
Copy link
Owner

jkacer commented Jul 18, 2017

At the moment, there are just SQL scripts for Oracle and H2 that show how to create the configuration table and fill it with data. It's in src/db-examples.
I'll try to add a ReadMe file that will show how to use the library. We use it in CAS 5.0 together with base PAC4J 1.9.6.
I'll keep you updated here...

@jkacer jkacer self-assigned this Jul 18, 2017
@andrew-boutin
Copy link
Author

OK I appreciate it and your quick responses!

I have a Spring Boot project and here's what I had before starting to use your library:

final SAML2ClientConfiguration cfg = new SAML2ClientConfiguration("classpath:saml/samlKeystore.jks",
                                                                          "pac4j-demo-passwd",
                                                                          "pac4j-demo-passwd",
                                                                          "classpath:saml/idp.xml");
cfg.setServiceProviderEntityId("entityId");
final SAML2Client saml2Client = new SAML2Client(cfg);
return new Config(new Clients("http://url:port/blah/callback", saml2Client));

would it simply be something like this now?:

SamlClientDao samlClientDao = new SamlClientDao() {
            @Override
            public List<String> loadClientNames() {
                return null; // Implement
            }

            @Override
            public List<DbLoadedSamlClientConfigurationDto> loadAllClients() {
                return null; // Implement
            }

            @Override
            public DbLoadedSamlClientConfigurationDto loadClient(String clientName) {
                return null; // Implement
            }
        };

DatabaseLoadedSAML2Clients databaseLoadedSAML2Clients = new DatabaseLoadedSAML2Clients(samlClientDao);
databaseLoadedSAML2Clients.setCallbackUrl("http://url:port/blah/callback");
return new Config(databaseLoadedSAML2Clients);

@jkacer
Copy link
Owner

jkacer commented Jul 25, 2017

Yes, something like this, just for the DAO, you can use an already existing implementation: SpringJdbcTemplateSamlClientDaoImpl, provided you are OK with a dependency on a Spring library. Or is there another reason why you want to avoid using this implementation?

@andrew-boutin
Copy link
Author

@jkacer I'm working with a pre-existing database/schema that stores the SAML configuration data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants