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

Add new authenticator configs for user defined auth extensions. #6114

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
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

package org.wso2.carbon.identity.application.common.model;

import org.wso2.carbon.identity.action.management.model.AuthProperty;
import org.wso2.carbon.identity.action.management.model.Authentication;
import org.wso2.carbon.identity.action.management.model.EndpointConfig;

import java.util.HashMap;
import java.util.Map;

/**
Expand All @@ -40,6 +42,40 @@ public EndpointConfig getEndpointConfig() {
return endpointConfig;
}

/**
* Get the URI of the authenticator endpoint of the user defined authenticator.
*
* @return URI of the authenticator endpoint.
*/
public String getAuthenticatorEndpointUri() {

return endpointConfig.getUri();
}

/**
* Get the authentication type of the authenticator endpoint of the user defined authenticator.
*
* @return Authentication type of the authenticator endpoint.
*/
public String getAuthenticatorEndpointAuthenticationType() {

return endpointConfig.getAuthentication().getType().getName();
}

/**
* Get the authentication properties of the authenticator endpoint of the user defined authenticator.
*
* @return Authentication properties of the authenticator endpoint.
*/
public Map<String, String> getAuthenticatorEndpointAuthenticationProperties() {

Map<String, String> propertyMap = new HashMap<>();
for (AuthProperty prop: endpointConfig.getAuthentication().getProperties()) {
propertyMap.put(prop.getName(), prop.getValue());
}
return propertyMap;
}

/**
* UserDefinedAuthenticatorEndpointConfig builder.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ public void createEndpointConfigurationTest(String uri, String authenticationTyp
endpointConfigBuilder.authenticationProperties(endpointConfig);
UserDefinedAuthenticatorEndpointConfig authEndpointConfig = endpointConfigBuilder.build();

assertEquals(authEndpointConfig.getEndpointConfig().getUri(), uri);
assertEquals(authEndpointConfig.getEndpointConfig().getAuthentication().getType().getName(),
authenticationType);
assertEquals(authEndpointConfig.getEndpointConfig().getAuthentication().getProperties().size(),
endpointConfig.size());
assertEquals(authEndpointConfig.getAuthenticatorEndpointUri(), uri);
assertEquals(authEndpointConfig.getAuthenticatorEndpointAuthenticationType(), authenticationType);
assertEquals(authEndpointConfig.getAuthenticatorEndpointAuthenticationProperties(), endpointConfig);
}

@DataProvider(name = "invalidEndpointConfig")
Expand Down
Loading