Skip to content

Commit 303e781

Browse files
authored
Merge pull request #1069 from atlanhq/FT-816
Adds limited ability to configure an SSO provider
2 parents 5f64c24 + 5edc3e7 commit 303e781

File tree

3 files changed

+134
-2
lines changed

3 files changed

+134
-2
lines changed

sdk/src/main/java/com/atlan/api/SSOEndpoint.java

+50-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.atlan.exception.InvalidRequestException;
99
import com.atlan.model.admin.AtlanGroup;
1010
import com.atlan.model.admin.SSOMapping;
11+
import com.atlan.model.admin.SSOProviderRequest;
1112
import com.atlan.net.ApiResource;
1213
import com.atlan.net.RequestOptions;
1314
import com.fasterxml.jackson.core.JsonGenerator;
@@ -40,6 +41,54 @@ public SSOEndpoint(AtlanClient client) {
4041
super(client);
4142
}
4243

44+
/**
45+
* Configure an SSO provider.
46+
*
47+
* @param request details of the configuration for an SSO provider
48+
* @throws AtlanException on any API communication issue
49+
*/
50+
public void configure(SSOProviderRequest request) throws AtlanException {
51+
configure(request, null);
52+
}
53+
54+
/**
55+
* Configure an SSO provider.
56+
*
57+
* @param request details of the configuration for an SSO provider
58+
* @param options to override default client settings
59+
* @throws AtlanException on any API communication issue
60+
*/
61+
public void configure(SSOProviderRequest request, RequestOptions options) throws AtlanException {
62+
String url = String.format("%s%s", getBaseUrl(), endpoint);
63+
ApiResource.request(client, ApiResource.RequestMethod.POST, url, request, options);
64+
}
65+
66+
/**
67+
* Creates a new Atlan SSO mapping.
68+
*
69+
* @param ssoAlias name of the SSO provider
70+
* @param mapping details of the mapping to create
71+
* @return created SSO mapping
72+
* @throws AtlanException on any API communication issue
73+
*/
74+
public SSOMapping createMapping(String ssoAlias, SSOMapping mapping) throws AtlanException {
75+
return createMapping(ssoAlias, mapping, null);
76+
}
77+
78+
/**
79+
* Creates a new Atlan SSO mapping.
80+
*
81+
* @param ssoAlias name of the SSO provider
82+
* @param mapping details of the mapping to create
83+
* @param options to override default client settings
84+
* @return created SSO mapping
85+
* @throws AtlanException on any API communication issue
86+
*/
87+
public SSOMapping createMapping(String ssoAlias, SSOMapping mapping, RequestOptions options) throws AtlanException {
88+
String url = String.format("%s%s/%s/mappers", getBaseUrl(), endpoint, ssoAlias);
89+
return ApiResource.request(client, ApiResource.RequestMethod.POST, url, mapping, SSOMapping.class, options);
90+
}
91+
4392
/**
4493
* Retrieves all existing Atlan SSO group mappings.
4594
*
@@ -132,8 +181,7 @@ public SSOMapping createGroupMapping(String ssoAlias, AtlanGroup group, String s
132181
.identityProviderAlias(ssoAlias)
133182
.identityProviderMapper(IDP_GROUP_MAPPER)
134183
.build();
135-
String url = String.format("%s%s/%s/mappers", getBaseUrl(), endpoint, ssoAlias);
136-
return ApiResource.request(client, ApiResource.RequestMethod.POST, url, request, SSOMapping.class, options);
184+
return createMapping(ssoAlias, request, options);
137185
}
138186

139187
/**

sdk/src/main/java/com/atlan/model/admin/SSOMapping.java

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public static final class Config extends AtlanObject {
5252
@JsonProperty("group")
5353
String groupName;
5454

55+
/** Name of the user attribute. */
56+
@JsonProperty("user.attribute")
57+
String userAttribute;
58+
5559
/** Name of the SSO attribute containing the mapping. */
5660
@JsonProperty("attribute.name")
5761
String attributeName;
@@ -67,5 +71,8 @@ public static final class Config extends AtlanObject {
6771
/** TBC */
6872
@JsonProperty("are.attribute.values.regex")
6973
String attributeValuesRegex;
74+
75+
/** TBC */
76+
String role;
7077
}
7178
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/* SPDX-License-Identifier: Apache-2.0
2+
Copyright 2023 Atlan Pte. Ltd. */
3+
package com.atlan.model.admin;
4+
5+
import com.atlan.model.core.AtlanObject;
6+
import lombok.*;
7+
import lombok.experimental.SuperBuilder;
8+
import lombok.extern.jackson.Jacksonized;
9+
10+
@Getter
11+
@SuperBuilder(toBuilder = true)
12+
@EqualsAndHashCode(callSuper = true)
13+
@ToString(callSuper = true)
14+
public class SSOProviderRequest extends AtlanObject {
15+
private static final long serialVersionUID = 2L;
16+
17+
/** Alias for the SSO provider. */
18+
String alias;
19+
20+
/** Type of SSO provider (for example, {@code saml}). */
21+
String providerId;
22+
23+
/** Whether the provider should be active (true) or not (false). */
24+
@Builder.Default
25+
Boolean enabled = true;
26+
27+
/** TBC */
28+
Boolean trustEmail;
29+
30+
/** TBC */
31+
Boolean storeToken;
32+
33+
/** TBC */
34+
Boolean addReadTokenRoleOnCreate;
35+
36+
/** TBC */
37+
Boolean linkOnly;
38+
39+
/** TBC */
40+
String firstBrokerLoginFlowAlias;
41+
42+
/** Label to show users for logging in with this provider. */
43+
String displayName;
44+
45+
/** Configuration for the provider. */
46+
Config config;
47+
48+
@Getter
49+
@Jacksonized
50+
@Builder(toBuilder = true)
51+
@EqualsAndHashCode(callSuper = true)
52+
@ToString(callSuper = true)
53+
public static final class Config extends AtlanObject {
54+
private static final long serialVersionUID = 2L;
55+
56+
/** TBC */
57+
String nameIDPolicyFormat;
58+
59+
/** TBC */
60+
String postBindingAuthnRequest;
61+
62+
/** TBC */
63+
String postBindingResponse;
64+
65+
/** TBC */
66+
String principalType;
67+
68+
/** TBC */
69+
String syncMode;
70+
71+
/** TBC */
72+
String singleSignOnServiceUrl;
73+
74+
/** TBC */
75+
String signingCertificate;
76+
}
77+
}

0 commit comments

Comments
 (0)