-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYNCOPE-1844] Support Okta authentication and attribute repository
- Loading branch information
Showing
10 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
common/am/lib/src/main/java/org/apache/syncope/common/lib/AbstractOktaConf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.syncope.common.lib; | ||
|
||
import java.io.Serializable; | ||
|
||
public abstract class AbstractOktaConf implements Serializable { | ||
|
||
private static final long serialVersionUID = -7800528759438661362L; | ||
|
||
private String organizationUrl; | ||
|
||
public String getOrganizationUrl() { | ||
return organizationUrl; | ||
} | ||
|
||
public void setOrganizationUrl(final String organizationUrl) { | ||
this.organizationUrl = organizationUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
common/am/lib/src/main/java/org/apache/syncope/common/lib/attr/OktaAttrRepoConf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.syncope.common.lib.attr; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import org.apache.syncope.common.lib.AbstractOktaConf; | ||
import org.apache.syncope.common.lib.to.AttrRepoTO; | ||
|
||
public class OktaAttrRepoConf extends AbstractOktaConf implements AttrRepoConf { | ||
|
||
private static final long serialVersionUID = 1019473980380211566L; | ||
|
||
/** | ||
* Username attribute to fetch attributes by. | ||
*/ | ||
private String usernameAttribute = "username"; | ||
|
||
/** | ||
* Okta allows you to interact with Okta APIs using scoped OAuth 2.0 access tokens. Each access token | ||
* enables the bearer to perform specific actions on specific Okta endpoints, with that | ||
* ability controlled by which scopes the access token contains. Scopes are only used | ||
* when using client id and private-key. | ||
*/ | ||
private final List<String> scopes = Stream.of("okta.users.read", "okta.apps.read").collect(Collectors.toList()); | ||
|
||
/** | ||
* Okta API token. | ||
*/ | ||
private String apiToken; | ||
|
||
public String getUsernameAttribute() { | ||
return usernameAttribute; | ||
} | ||
|
||
public void setUsernameAttribute(final String usernameAttribute) { | ||
this.usernameAttribute = usernameAttribute; | ||
} | ||
|
||
public String getApiToken() { | ||
return apiToken; | ||
} | ||
|
||
public void setApiToken(final String apiToken) { | ||
this.apiToken = apiToken; | ||
} | ||
|
||
public List<String> getScopes() { | ||
return scopes; | ||
} | ||
|
||
@Override | ||
public Map<String, Object> map(final AttrRepoTO attrRepo, final Mapper mapper) { | ||
return mapper.map(attrRepo, this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/OktaAuthModuleConf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.syncope.common.lib.auth; | ||
|
||
import java.util.Map; | ||
import org.apache.syncope.common.lib.AbstractOktaConf; | ||
import org.apache.syncope.common.lib.to.AuthModuleTO; | ||
|
||
public class OktaAuthModuleConf extends AbstractOktaConf implements AuthModuleConf { | ||
|
||
private static final long serialVersionUID = -696882546462937138L; | ||
|
||
/** | ||
* A number of authentication handlers are allowed to determine whether they can operate on the provided credential | ||
* and as such lend themselves to be tried and tested during the authentication handler selection phase. | ||
* The credential criteria may be one of the following options:<ul> | ||
* <li>A regular expression pattern that is tested against the credential identifier.</li> | ||
* <li>A fully qualified class name of your own design that implements {@code Predicate}.</li> | ||
* <li>Path to an external Groovy script that implements the same interface.</li> | ||
* </ul> | ||
*/ | ||
private String credentialCriteria; | ||
|
||
public String getCredentialCriteria() { | ||
return credentialCriteria; | ||
} | ||
|
||
public void setCredentialCriteria(final String credentialCriteria) { | ||
this.credentialCriteria = credentialCriteria; | ||
} | ||
|
||
@Override | ||
public Map<String, Object> map(final AuthModuleTO authModule, final Mapper mapper) { | ||
return mapper.map(authModule, this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters