-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6108 from Thisara-Welmilla/add-user-defined-auth-…
…config Add new authenticator configs for user defined authentication extensions.
- Loading branch information
Showing
10 changed files
with
411 additions
and
23 deletions.
There are no files selected for viewing
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
88 changes: 88 additions & 0 deletions
88
...wso2/carbon/identity/application/common/model/UserDefinedAuthenticatorEndpointConfig.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,88 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. 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.wso2.carbon.identity.application.common.model; | ||
|
||
import org.wso2.carbon.identity.action.management.model.Authentication; | ||
import org.wso2.carbon.identity.action.management.model.EndpointConfig; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The authenticator endpoint configuration model for the user defined authenticator configurations. | ||
*/ | ||
public class UserDefinedAuthenticatorEndpointConfig { | ||
|
||
private final EndpointConfig endpointConfig; | ||
|
||
private UserDefinedAuthenticatorEndpointConfig(UserDefinedAuthenticatorEndpointConfigBuilder builder) { | ||
|
||
endpointConfig = builder.endpointConfig; | ||
} | ||
|
||
public EndpointConfig getEndpointConfig() { | ||
|
||
return endpointConfig; | ||
} | ||
|
||
/** | ||
* UserDefinedAuthenticatorEndpointConfig builder. | ||
*/ | ||
public static class UserDefinedAuthenticatorEndpointConfigBuilder { | ||
|
||
private String uri; | ||
private String authenticationType; | ||
private Map<String, String> authenticationProperties; | ||
private EndpointConfig endpointConfig; | ||
|
||
public UserDefinedAuthenticatorEndpointConfigBuilder() { | ||
} | ||
|
||
public UserDefinedAuthenticatorEndpointConfigBuilder uri(String uri) { | ||
|
||
this.uri = uri; | ||
return this; | ||
} | ||
|
||
public UserDefinedAuthenticatorEndpointConfigBuilder authenticationProperties( | ||
Map<String, String> authentication) { | ||
|
||
this.authenticationProperties = authentication; | ||
return this; | ||
} | ||
|
||
public UserDefinedAuthenticatorEndpointConfigBuilder authenticationType(String authenticationType) { | ||
|
||
this.authenticationType = authenticationType; | ||
return this; | ||
} | ||
|
||
public UserDefinedAuthenticatorEndpointConfig build() { | ||
|
||
EndpointConfig.EndpointConfigBuilder endpointConfigBuilder = new EndpointConfig.EndpointConfigBuilder(); | ||
endpointConfigBuilder.uri(uri); | ||
endpointConfigBuilder.authentication(new Authentication.AuthenticationBuilder() | ||
.type(Authentication.Type.valueOf(authenticationType)) | ||
.properties(authenticationProperties) | ||
.build()); | ||
endpointConfig = endpointConfigBuilder.build(); | ||
|
||
return new UserDefinedAuthenticatorEndpointConfig(this); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...so2/carbon/identity/application/common/model/UserDefinedFederatedAuthenticatorConfig.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,57 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. 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.wso2.carbon.identity.application.common.model; | ||
|
||
import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; | ||
|
||
/** | ||
* The user defined federated authenticator configuration model. | ||
*/ | ||
public class UserDefinedFederatedAuthenticatorConfig extends FederatedAuthenticatorConfig { | ||
|
||
private static final String TAG_CUSTOM = "CUSTOM"; | ||
|
||
protected UserDefinedAuthenticatorEndpointConfig endpointConfig; | ||
|
||
public UserDefinedFederatedAuthenticatorConfig() { | ||
|
||
definedByType = DefinedByType.USER; | ||
setTags(new String[]{TAG_CUSTOM}); | ||
} | ||
|
||
/** | ||
* Get the endpoint configurations of the User defined federated authenticator config. | ||
* | ||
* @return UserDefinedAuthenticatorEndpointConfig | ||
*/ | ||
public UserDefinedAuthenticatorEndpointConfig getEndpointConfig() { | ||
|
||
return endpointConfig; | ||
} | ||
|
||
/** | ||
* Set the endpoint configurations of the User defined federated authenticator config. | ||
* | ||
* @param endpointConfig The endpoint config of the User defined federated authenticator config. | ||
*/ | ||
public void setEndpointConfig(UserDefinedAuthenticatorEndpointConfig endpointConfig) { | ||
|
||
this.endpointConfig = endpointConfig; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...rg/wso2/carbon/identity/application/common/model/UserDefinedLocalAuthenticatorConfig.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,63 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). | ||
* | ||
* WSO2 LLC. 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.wso2.carbon.identity.application.common.model; | ||
|
||
import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.AuthenticationType; | ||
import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; | ||
|
||
/** | ||
* The user defined local authenticator configuration model. | ||
*/ | ||
public class UserDefinedLocalAuthenticatorConfig extends LocalAuthenticatorConfig { | ||
|
||
private static final String TAG_2FA = "2FA"; | ||
private static final String TAG_CUSTOM = "CUSTOM"; | ||
|
||
protected UserDefinedAuthenticatorEndpointConfig endpointConfig; | ||
|
||
public UserDefinedLocalAuthenticatorConfig(AuthenticationType type) { | ||
|
||
definedByType = DefinedByType.USER; | ||
if (AuthenticationType.VERIFICATION == type) { | ||
setTags(new String[]{TAG_CUSTOM, TAG_2FA}); | ||
} else { | ||
setTags(new String[]{TAG_CUSTOM}); | ||
} | ||
} | ||
|
||
/** | ||
* Get the endpoint configurations of the User defined local authenticator config. | ||
* | ||
* @return UserDefinedAuthenticatorEndpointConfig | ||
*/ | ||
public UserDefinedAuthenticatorEndpointConfig getEndpointConfig() { | ||
|
||
return endpointConfig; | ||
} | ||
|
||
/** | ||
* Set the endpoint configurations of the User defined local authenticator config. | ||
* | ||
* @param endpointConfig The endpoint config of the User defined local authenticator config. | ||
*/ | ||
public void setEndpointConfig(UserDefinedAuthenticatorEndpointConfig endpointConfig) { | ||
|
||
this.endpointConfig = endpointConfig; | ||
} | ||
} |
Oops, something went wrong.