Skip to content

Commit 3379d0c

Browse files
authored
First pass refactoring for SSO Login authentication flow (#59)
* Start refactoring to support both username and password auth, as well as SSO login flows * Wrap up refactor * Start cleaning up * more cleanup * Properly handle SSO Session expiration * bump to release version 3.0.0 * start on docs * start on docs * start on docs * update docs * update readme * update docs * finishd ocs * finishd ocs
1 parent 051a071 commit 3379d0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4358
-1455
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ target/
44

55
## Ignore credentials for running integration tests
66
src/test/resources/test_credentials.properties
7+
src/test/resources/*_credentials.properties

3_0_0_migration_notes.MD

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Pardot Java API Client 2.x.x to 3.0.0 Migration Guide
2+
3+
## Authentication & Configuration Breaking Changes
4+
5+
In order to properly support the transition of the Pardot API from authenticating using Pardot username, password, and user keys, to
6+
Salesforce Single Signon, several breaking changes were made to how you configure the Pardot API Client.
7+
8+
### Configuration class replaced with ConfigurationBuilder.
9+
10+
Where before you created a `Configuration` object, that class has now been replaced by `ConfigurationBuilder`.
11+
12+
**Code that may have looked like this previously**
13+
```java
14+
final Configuration configuration = new Configuration("YourPardotUserNameHere", "PardotPassword", "UserKey");
15+
final PardotClient client = new PardotClient(configuration);
16+
```
17+
18+
**Should now look like this**
19+
```java
20+
final ConfigurationBuilder configuration = Configuration.newBuilder()
21+
// NOTE: Authenticating using this method will cease to function after ~ Feb. 1 2021.
22+
// See section below about migrating to SSO authentication.
23+
.withUsernameAndPasswordLogin(
24+
"YourPardotUsername",
25+
"YourPardotPassword",
26+
"YourPardotUserKey"
27+
);
28+
29+
// Call other methods on configuration instance as needed to complete configuration.
30+
final PardotClient client = new PardotClient(configuration);
31+
```
32+
33+
### Pardot Username and Password Authentication Scheme deprecated in favor of Salesforce SSO Authentication.
34+
35+
From February 1, 2021 Pardot is removing the now legacy Pardot Username and Password authentication scheme ([Salesforce EOL Notice](https://help.salesforce.com/articleView?id=000353746&type=1&mode=1&language=en_US&utm_source=techcomms&utm_medium=email&utm_campaign=eol)).
36+
37+
You should switch to configuring authentication using the following method:
38+
39+
```java
40+
final ConfigurationBuilder configuration = Configuration.newBuilder()
41+
.withSsoLogin(
42+
"YourSalesforceUsername",
43+
"YourSalesforcePassword",
44+
"YourConnectedAppClientId",
45+
"YourConnectedAppClientSecret",
46+
"YourPardotBusinessUnitId"
47+
);
48+
final PardotClient client = new PardotClient(configuration);
49+
```
50+
51+
See [Offical Pardot Developer Documentation](https://developer.pardot.com/kb/authentication/) and [Salesforce OAuth Setup](https://help.salesforce.com/articleView?id=remoteaccess_oauth_flows.htm) for details on how to obtain the above required properties.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
The format is based on [Keep a Changelog](http://keepachangelog.com/)
33
and this project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## 3.0.0 (UNRELEASED)
6+
- [ISSUE-58](https://github.com/Crim/pardot-java-client/issues/58) Add support for Salesforce SSO authentication.
7+
8+
### Breaking Change
9+
See [3.0.0 Migration Notes](3_0_0_migration_notes.MD) for details on breaking changes and how to upgrade.
10+
511
## 2.1.0 (07/30/2020)
612
- [ISSUE-56](https://github.com/Crim/pardot-java-client/issues/56) Adds support for Dynamic Content.
713

README.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44

55
## What is it?
66

7-
A fluent-ish style API client for Pardot's API (version 3 and 4).
7+
This library is a fluent style API client for Pardot's API (version 3 and 4).
88

9-
**Note** It currently is not fully featured/fully implemented. If there is a feature/end point that you
9+
## Important Breaking Change to Pardot API
10+
11+
From February 1, 2021 Pardot is removing the ability to authenticate to the Pardot API using your Pardot username, password, and userkey ([Salesforce EOL Notice](https://help.salesforce.com/articleView?id=000353746&type=1&mode=1&language=en_US&utm_source=techcomms&utm_medium=email&utm_campaign=eol)).
12+
This means that versions of this library **prior to 3.0.0** will cease to be able to authenticate to the Pardot Api.
13+
14+
Everyone is encouraged to update the library to version **3.0.0 or newer** and switch to using Salesforce SSO authentication prior to February 1, 2021.
15+
To support Salesforce SSO authentication required backwards compatibility breaking changes to be made to this library, so please read the [2.x.x to 3.0.0 Migration Guide](3_0_0_migration_notes.MD)
16+
which details the changes required to upgrade.
17+
18+
**Note** While most of Pardot's API is supported by this library, if there is a feature/end point that you
1019
need that is not yet implemented, please read the **[How to Contribute](#how-to-contribute)** section, or **[Create an issue](https://github.com/Crim/pardot-java-client/issues)**
1120
requesting it.
1221

@@ -21,23 +30,31 @@ This client library is released on Maven Central. Add a new dependency to your
2130
<dependency>
2231
<groupId>com.darksci</groupId>
2332
<artifactId>pardot-api-client</artifactId>
24-
<version>2.1.0</version>
33+
<version>3.0.0</version>
2534
</dependency>
2635
```
2736

28-
Example Code:
37+
Example Code using Salesforce SSO Authentication:
2938
```java
3039
/*
31-
* Create a new configuration object with your Pardot credentials.
40+
* Create a new configuration object with your Salesforce SSO credentials.
3241
*
3342
* This configuration also allows you to define some optional details on your connection,
3443
* such as using an outbound proxy (authenticated or not).
3544
*/
36-
final Configuration configuration = new Configuration("YourPardotUserNameHere", "PardotPassword", "UserKey");
45+
final ConfigurationBuilder configuration = Configuration.newBuilder()
46+
.withSsoLogin(
47+
"YourSalesforceUsername",
48+
"YourSalesforcePassword",
49+
"YourConnectedAppClientId",
50+
"YourConnectedAppClientSecret",
51+
"YourPardotBusinessUnitId"
52+
);
3753

3854
/*
39-
* Optionally select which API version to use, if none is explicitly selected
40-
* the library will default to version 3.
55+
* Optionally you can explicitly select which API version to use. If none is explicitly selected
56+
* the library will default to version 3, but the library will automatically upgrade to version
57+
* 4 if required to do so.
4158
*/
4259
configuration.withApiVersion3();
4360

@@ -58,7 +75,6 @@ final PardotClient client = new PardotClient(configuration);
5875
final AccountReadRequest accountReadRequest = new AccountReadRequest();
5976
final Account account = client.accountRead(accountReadRequest);
6077

61-
6278
/*
6379
* Or lets do a more complex Campaign search.
6480
*/
@@ -80,7 +96,6 @@ Or Using the Try-With-Resources Pattern:
8096
/*
8197
* Since PardotClient implements Autoclosable, you can also use the try-with-resources pattern.
8298
*/
83-
final Configuration configuration = new Configuration("YourPardotUserNameHere", "PardotPassword", "UserKey");
8499
try (final PardotClient client = new PardotClient(configuration)) {
85100
// Use client instance as needed
86101
client.accountRead(new AccountReadRequest());
@@ -92,16 +107,16 @@ try (final PardotClient client = new PardotClient(configuration)) {
92107
## What Features are implemented?
93108

94109
### Authentication
95-
Official Documentation: [Authentication](http://developer.pardot.com/#authentication)
110+
Official Documentation: [Authentication](https://developer.pardot.com/kb/authentication/)
96111

97-
Authenticating with Pardot's API using your Pardot Username, Password, and User Token.
112+
- Authenticating with Pardot's API using your Salesforce SSO Username, Password, and Connected Application details. [See Example](src/main/java/com/darksci/pardot/api/Example.java#L37).
113+
- Legacy authentication using your Pardot Username, Password, and User Token. [See Example](src/main/java/com/darksci/pardot/api/Example.java#L98).
98114

99115
### Accounts
100116
Official Documentation: [Accounts](http://developer.pardot.com/kb/api-version-3/accounts/)
101117

102118
- Read
103119

104-
105120
### Campaigns
106121
Official Documentation: [Campaigns](http://developer.pardot.com/kb/api-version-3/campaigns/)
107122

@@ -228,14 +243,6 @@ Official Documentation: [VisitorActivities](http://developer.pardot.com/kb/api-v
228243
- Query
229244
- Read
230245

231-
## Important Breaking Change to Pardot API
232-
233-
As of October 31, 2018 Pardot is disabling the TLS 1.0 encryption protocol. This means that versions of this library
234-
**prior to 1.0.0** will cease to be able to connect to the Pardot Api.
235-
236-
Version 1.0.0+ updates the library to use TLS 1.1 and 1.2 protocols. Everyone is encouraged to update
237-
the library prior to October 31st 2018.
238-
239246
## How to Contribute
240247

241248
Want to help implement the missing API end points? Fork the repository, write some code, and

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.darksci</groupId>
88
<artifactId>pardot-api-client</artifactId>
9-
<version>2.1.0</version>
9+
<version>3.0.0</version>
1010
<packaging>jar</packaging>
1111

1212
<!-- Require Maven 3.5.0 -->

0 commit comments

Comments
 (0)