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

Java SDK v5.0.0 (openAPI v2.6.0) #619

Merged
merged 5 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>okta-sdk-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>okta-sdk-coverage</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>okta-sdk-examples</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-examples</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion httpclients/httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion httpclients/okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>

<artifactId>okta-sdk-impl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import com.okta.sdk.resource.ResourceException
import com.okta.sdk.resource.application.*
import com.okta.sdk.resource.group.Group
import com.okta.sdk.resource.group.GroupBuilder
import com.okta.sdk.resource.inline.hook.InlineHook
import com.okta.sdk.resource.inline.hook.InlineHookBuilder
import com.okta.sdk.resource.inline.hook.InlineHookChannel
import com.okta.sdk.resource.inline.hook.InlineHookType
import com.okta.sdk.resource.user.User
import com.okta.sdk.resource.user.schema.UserSchema
import com.okta.sdk.resource.user.schema.UserSchemaDefinitions
Expand Down Expand Up @@ -116,7 +120,13 @@ class ApplicationsIT extends ITSupport {
.setSettings(client.instantiate(AutoLoginApplicationSettings)
.setSignOn(client.instantiate(AutoLoginApplicationSettingsSignOn)
.setRedirectUrl("http://swasecondaryredirecturl.okta.com")
.setLoginUrl("http://swaprimaryloginurl.okta.com"))))
.setLoginUrl("http://swaprimaryloginurl.okta.com"))
.setNotes(
client.instantiate(ApplicationSettingsNotes)
.setAdmin("Notes for Admin")
.setEnduser("Notes for EndUser")
)
))
// search the resource collection looking for the new resource
Optional optional = client.listApplications().stream()
.filter {it.getId() == resource.getId()}
Expand Down Expand Up @@ -185,6 +195,18 @@ class ApplicationsIT extends ITSupport {

@Test (groups = "group1")
void crudSaml20() {

String name = "java-sdk-it-" + UUID.randomUUID().toString()
InlineHook createdInlineHook = InlineHookBuilder.instance()
.setName(name)
.setHookType(InlineHookType.SAML_TOKENS_TRANSFORM)
.setChannelType(InlineHookChannel.TypeEnum.HTTP)
.setUrl("https://www.example.com/inlineHooks")
.setAuthorizationHeaderValue("Test-Api-Key")
.addHeader("X-Test-Header", "Test header value")
.buildAndCreate(client)
registerForCleanup(createdInlineHook)

doCrudTest(client.instantiate(SamlApplication)
.setVisibility(client.instantiate(ApplicationVisibility)
.setAutoSubmitToolbar(false)
Expand All @@ -209,6 +231,11 @@ class ApplicationsIT extends ITSupport {
.setAuthnContextClassRef("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport")
.setSpIssuer(null)
.setRequestCompressed(false)
.setInlineHooks(Arrays.asList(
client
.instantiate(SignOnInlineHook)
.setId(createdInlineHook.getId())
))
.setAttributeStatements(new ArrayList<SamlAttributeStatement>([
client.instantiate(SamlAttributeStatement)
.setType("EXPRESSION")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import com.okta.sdk.resource.authorization.server.policy.AuthorizationServerPoli
import com.okta.sdk.resource.authorization.server.policy.AuthorizationServerPolicyRuleActions
import com.okta.sdk.resource.authorization.server.policy.AuthorizationServerPolicyRuleConditions
import com.okta.sdk.resource.authorization.server.policy.TokenAuthorizationServerPolicyRuleAction
import com.okta.sdk.resource.authorization.server.policy.TokenAuthorizationServerPolicyRuleActionInlineHook
import com.okta.sdk.resource.inline.hook.InlineHook
import com.okta.sdk.resource.inline.hook.InlineHookBuilder
import com.okta.sdk.resource.inline.hook.InlineHookChannel
import com.okta.sdk.resource.inline.hook.InlineHookType
import com.okta.sdk.resource.policy.*
import com.okta.sdk.tests.it.util.ITSupport
import org.testng.annotations.Test
Expand Down Expand Up @@ -454,6 +459,17 @@ class AuthorizationServerIT extends ITSupport {
assertThat(retrievedPolicy, notNullValue())
assertThat(retrievedPolicy.getId(), equalTo(createdPolicy.getId()))

String hookName = "java-sdk-it-" + UUID.randomUUID().toString()
InlineHook createdInlineHook = InlineHookBuilder.instance()
.setName(hookName)
.setHookType(InlineHookType.OAUTH2_TOKENS_TRANSFORM)
.setChannelType(InlineHookChannel.TypeEnum.HTTP)
.setUrl("https://www.example.com/inlineHooks")
.setAuthorizationHeaderValue("Test-Api-Key")
.addHeader("X-Test-Header", "Test header value")
.buildAndCreate(client)
registerForCleanup(createdInlineHook)

AuthorizationServerPolicyRule createdPolicyRule = retrievedPolicy.createPolicyRule(createdAuthorizationServer.getId(),
client.instantiate(AuthorizationServerPolicyRule)
.setName(name)
Expand All @@ -473,6 +489,10 @@ class AuthorizationServerIT extends ITSupport {
.setAccessTokenLifetimeMinutes(60)
.setRefreshTokenLifetimeMinutes(0)
.setRefreshTokenWindowMinutes(10080)
.setInlineHook(
client.instantiate(TokenAuthorizationServerPolicyRuleActionInlineHook)
.setId(createdInlineHook.getId())
)
)
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 2020-Present Okta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.okta.sdk.tests.it

import com.okta.sdk.resource.ResourceException
import com.okta.sdk.resource.domain.Domain
import com.okta.sdk.resource.domain.DomainCertificateSourceType
import com.okta.sdk.tests.it.util.ITSupport
import org.testng.Assert
import org.testng.annotations.Test

import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.Matchers.*

/**
* Tests for {@code /api/v1/domains}.
*/
class DomainIT extends ITSupport {

@Test(groups = "group1")
void customTemplatesCrudTest() {

String domain = "java-sdk-it-${UUID.randomUUID().toString()}.example.com"

def domainCreated = client.createDomain(
client.instantiate(Domain)
.setDomain(domain)
.setCertificateSourceType(DomainCertificateSourceType.MANUAL)
)

assertThat(domainCreated, notNullValue())
assertThat(domainCreated.getId(), notNullValue())
assertThat(domainCreated.getDomain(), equalTo(domain))
assertThat(domainCreated.getCertificateSourceType(), equalTo(DomainCertificateSourceType.MANUAL))

def domainFetched = client.getDomain(domainCreated.getId())

assertThat(domainFetched, notNullValue())
assertThat(domainFetched.getId(), equalTo(domainCreated.getId()))

client.deleteDomain(domainCreated.getId())

try {
client.verifyDomain(domainCreated.getId())
Assert.fail("Expected ResourceException (404)")
} catch (ResourceException e) {
assertThat(e.status, equalTo(404))
}
}
}
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Okta Java SDK</name>
Expand All @@ -39,7 +39,7 @@
<snakeyaml.version>1.26</snakeyaml.version>
<bouncycastle.version>1.68</bouncycastle.version>
<jjwt.version>0.11.1</jjwt.version>
<okta.sdk.previousVersion>4.1.0</okta.sdk.previousVersion>
<okta.sdk.previousVersion>4.1.1</okta.sdk.previousVersion>
<okta.commons.version>1.2.6</okta.commons.version>

<github.slug>okta/okta-sdk-java</github.slug>
Expand Down Expand Up @@ -72,27 +72,27 @@
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-api</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-impl</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-api-swagger-templates</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-httpclient</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-okhttp</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>

<!-- Other Okta Projects -->
Expand Down Expand Up @@ -131,14 +131,14 @@
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-integration-tests</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>

<!-- Examples -->
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-examples-quickstart</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>

<!-- Logging -->
Expand Down Expand Up @@ -316,7 +316,7 @@
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-api-swagger-templates</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -343,7 +343,7 @@
</oldVersion>
<parameter>
<onlyModified>true</onlyModified>
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
<breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
<breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
<postAnalysisScript>${root.dir}/src/japicmp/postAnalysisScript.groovy</postAnalysisScript>
</parameter>
Expand Down
Loading