本文整理汇总了Java中org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig类的典型用法代码示例。如果您正苦于以下问题:Java StepConfig类的具体用法?Java StepConfig怎么用?Java StepConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StepConfig类属于org.wso2.carbon.identity.application.authentication.framework.config.model包,在下文中一共展示了StepConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleClaimMappings
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
/**
* @param stepConfig
* @param context
* @param extAttrs
* @param isFederatedClaims
* @return
*/
protected Map<String, String> handleClaimMappings(StepConfig stepConfig,
AuthenticationContext context,
Map<String, String> extAttrs,
boolean isFederatedClaims) throws FrameworkException {
Map<String, String> mappedAttrs;
try {
mappedAttrs = FrameworkUtils.getClaimHandler().handleClaimMappings(stepConfig, context,
extAttrs, isFederatedClaims);
return mappedAttrs;
} catch (FrameworkException e) {
log.error("Claim handling failed!", e);
}
// Claim handling failed. So we are returning an empty map.
return Collections.emptyMap();
}
示例2: handleClaimMappings
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
@Override
public Map<String, String> handleClaimMappings(StepConfig stepConfig,
AuthenticationContext context, Map<String, String> remoteClaims,
boolean isFederatedClaims) throws FrameworkException {
if (log.isDebugEnabled()) {
logInput(remoteClaims, isFederatedClaims);
}
ApplicationConfig appConfig = context.getSequenceConfig().getApplicationConfig();
String spStandardDialect = getStandardDialect(context.getRequestType(), appConfig);
Map<String, String> returningClaims = null;
if (isFederatedClaims) {
returningClaims = handleFederatedClaims(remoteClaims, spStandardDialect, stepConfig, context);
} else {
returningClaims = handleLocalClaims(spStandardDialect, stepConfig, context);
}
if (log.isDebugEnabled()) {
logOutput(returningClaims, context);
}
return returningClaims;
}
示例3: testHandleClaimMappings
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
@Test
public void testHandleClaimMappings() throws Exception {
ClaimHandler claimHandler = mock(ClaimHandler.class);
Map<String, String> claims = new HashMap<>();
claims.put("claim1", "value1");
doReturn(claims).when(claimHandler).handleClaimMappings(any(StepConfig.class), any(AuthenticationContext.class),
any(Map.class), anyBoolean());
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getClaimHandler()).thenReturn(claimHandler);
claims = requestPathBasedSequenceHandler.handleClaimMappings(new AuthenticationContext());
assertNotNull(claims);
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:17,代码来源:DefaultRequestPathBasedSequenceHandlerTest.java
示例4: testHandleClaimMappingsFailed
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
@Test
public void testHandleClaimMappingsFailed() throws Exception {
ClaimHandler claimHandler = mock(ClaimHandler.class);
doThrow(new FrameworkException("Claim Handling failed"))
.when(claimHandler)
.handleClaimMappings(any(StepConfig.class), any(AuthenticationContext.class), any(Map.class), anyBoolean());
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getClaimHandler()).thenReturn(claimHandler);
Map<String, String> claims = stepBasedSequenceHandler.handleClaimMappings(
null,
new AuthenticationContext(),
new HashMap<String, String>(),
false);
assertNotNull(claims);
assertEquals(claims.size(), 0);
}
示例5: testHandleSingleStep
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
/**
* First step of the sequence is handled
*/
@Test
public void testHandleSingleStep() throws Exception {
// mock the step handler
StepHandler stepHandler = getMockedStepHandlerForIncompleteStep(true);
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
StepConfig stepConfig = new StepConfig();
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.getStepMap().put(1, stepConfig);
context.setSequenceConfig(sequenceConfig);
stepBasedSequenceHandler.handle(request, response, context);
assertFalse(context.getSequenceConfig().isCompleted());
assertTrue(context.isRequestAuthenticated());
}
示例6: testHandleSingleStepFinish
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
@Test
public void testHandleSingleStepFinish() throws Exception {
// mock the step handler
StepHandler stepHandler = getMockedStepHandlerForSuccessfulRequestAuthentication();
mockStatic(FrameworkUtils.class);
when(FrameworkUtils.getStepHandler()).thenReturn(stepHandler);
StepConfig stepConfig = new StepConfig();
SequenceConfig sequenceConfig = new SequenceConfig();
sequenceConfig.getStepMap().put(1, stepConfig);
context.setSequenceConfig(sequenceConfig);
doNothing().when(stepBasedSequenceHandler).handlePostAuthentication(any(HttpServletRequest.class), any
(HttpServletResponse.class), any(AuthenticationContext.class));
stepBasedSequenceHandler.handle(request, response, context);
assertTrue(context.getSequenceConfig().isCompleted());
assertTrue(context.isRequestAuthenticated());
assertResetContext(context);
}
示例7: getMockedStepHandlerForSuccessfulRequestAuthentication
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
private StepHandler getMockedStepHandlerForSuccessfulRequestAuthentication() throws Exception {
// mock the step handler
StepHandler stepHandler = mock(StepHandler.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
AuthenticationContext context = invocationOnMock.getArgumentAt(2, AuthenticationContext.class);
StepConfig stepConfig = context.getSequenceConfig().getStepMap().get(context.getCurrentStep());
stepConfig.setCompleted(true);
context.setRequestAuthenticated(true);
return null;
}
}).when(stepHandler).handle(any(HttpServletRequest.class), any(HttpServletResponse.class),
any(AuthenticationContext.class));
return stepHandler;
}
示例8: getMockedStepHandlerForIncompleteStep
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
private StepHandler getMockedStepHandlerForIncompleteStep(final boolean isRequestAuthenticated) throws Exception {
// mock the step handler
StepHandler stepHandler = mock(StepHandler.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
AuthenticationContext context = invocationOnMock.getArgumentAt(2, AuthenticationContext.class);
StepConfig stepConfig = context.getSequenceConfig().getStepMap().get(context.getCurrentStep());
stepConfig.setCompleted(false);
context.setRequestAuthenticated(isRequestAuthenticated);
return null;
}
}).when(stepHandler).handle(any(HttpServletRequest.class), any(HttpServletResponse.class),
any(AuthenticationContext.class));
return stepHandler;
}
示例9: processFirstStepOnly
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
/**
* In SMSOTP optional case proceed with first step only.It can be basic or federated.
*
* @param authenticatedUser the name of authenticatedUser
* @param context the AuthenticationContext
*/
private void processFirstStepOnly(AuthenticatedUser authenticatedUser, AuthenticationContext context) {
if (log.isDebugEnabled()) {
log.debug("Processing First step only. Skipping SMSOTP");
}
//the authentication flow happens with basic authentication.
StepConfig stepConfig = context.getSequenceConfig().getStepMap().get(context.getCurrentStep() - 1);
if (stepConfig.getAuthenticatedAutenticator().getApplicationAuthenticator() instanceof
LocalApplicationAuthenticator) {
if (log.isDebugEnabled()) {
log.debug("Found local authenticator in previous step. Hence setting a local user");
}
FederatedAuthenticatorUtil.updateLocalAuthenticatedUserInStepConfig(context, authenticatedUser);
context.setProperty(SMSOTPConstants.AUTHENTICATION, SMSOTPConstants.BASIC);
} else {
if (log.isDebugEnabled()) {
log.debug("Found federated authenticator in previous step. Hence setting a local user");
}
FederatedAuthenticatorUtil.updateAuthenticatedUserInStepConfig(context, authenticatedUser);
context.setProperty(SMSOTPConstants.AUTHENTICATION, SMSOTPConstants.FEDERETOR);
}
}
示例10: handleClaimMappings
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
/**
* @param stepConfig
* @param context
* @param extAttrs
* @param isFederatedClaims
* @return
*/
protected Map<String, String> handleClaimMappings(StepConfig stepConfig,
AuthenticationContext context, Map<String, String> extAttrs,
boolean isFederatedClaims)
throws FrameworkException {
Map<String, String> mappedAttrs = new HashMap<String, String>();
try {
mappedAttrs = FrameworkUtils.getClaimHandler().handleClaimMappings(stepConfig, context,
extAttrs, isFederatedClaims);
} catch (FrameworkException e) {
log.error("Claim handling failed!", e);
}
if(mappedAttrs == null){
mappedAttrs = new HashMap<>();
}
return mappedAttrs;
}
示例11: loadFederatedAuthenticators
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
private void loadFederatedAuthenticators(AuthenticationStep authenticationStep, StepConfig stepConfig) {
IdentityProvider[] federatedIDPs = authenticationStep.getFederatedIdentityProviders();
if (federatedIDPs != null) {
// for each idp in the step
for (IdentityProvider federatedIDP : federatedIDPs) {
FederatedAuthenticatorConfig federatedAuthenticator = federatedIDP
.getDefaultAuthenticatorConfig();
// for each authenticator in the idp
String actualAuthenticatorName = federatedAuthenticator.getName();
// assign it to the step
loadStepAuthenticator(stepConfig, federatedIDP, actualAuthenticatorName);
}
}
}
示例12: getUsername
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
private AuthenticatedUser getUsername(AuthenticationContext context) throws AuthenticationFailedException {
//username from authentication context.
AuthenticatedUser authenticatedUser = null;
for (int i = 1; i <= context.getSequenceConfig().getStepMap().size(); i++) {
StepConfig stepConfig = context.getSequenceConfig().getStepMap().get(i);
if (stepConfig.getAuthenticatedUser() != null && stepConfig.getAuthenticatedAutenticator()
.getApplicationAuthenticator() instanceof LocalApplicationAuthenticator) {
authenticatedUser = stepConfig.getAuthenticatedUser();
if (authenticatedUser.getUserStoreDomain() == null) {
authenticatedUser.setUserStoreDomain(UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME);
}
if (log.isDebugEnabled()) {
log.debug("username :" + authenticatedUser.toString());
}
break;
}
}
if(authenticatedUser == null){
throw new AuthenticationFailedException("Could not locate an authenticated username from previous steps " +
"of the sequence. Hence cannot continue with FIDO authentication.");
}
return authenticatedUser;
}
示例13: handleResponse
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
protected void handleResponse(HttpServletRequest request, HttpServletResponse response,
AuthenticationContext context) throws FrameworkException {
if (log.isDebugEnabled()) {
log.debug("Receive a response from the external party");
}
SequenceConfig sequenceConfig = context.getSequenceConfig();
int currentStep = context.getCurrentStep();
boolean isNoneCanHandle = true;
StepConfig stepConfig = sequenceConfig.getStepMap().get(currentStep);
for (AuthenticatorConfig authenticatorConfig : stepConfig.getAuthenticatorList()) {
ApplicationAuthenticator authenticator = authenticatorConfig
.getApplicationAuthenticator();
// Call authenticate if canHandle
if (authenticator != null && authenticator.canHandle(request)
&& (context.getCurrentAuthenticator() == null || authenticator.getName()
.equals(context.getCurrentAuthenticator()))) {
isNoneCanHandle = false;
if (log.isDebugEnabled()) {
log.debug(authenticator.getName() + " can handle the request.");
}
doAuthentication(request, response, context, authenticatorConfig);
break;
}
}
if (isNoneCanHandle) {
throw new FrameworkException("No authenticator can handle the request in step : " + currentStep);
}
}
示例14: populateStepConfigWithAuthenticationDetails
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
protected void populateStepConfigWithAuthenticationDetails(StepConfig stepConfig,
AuthenticatedIdPData authenticatedIdPData) {
stepConfig.setAuthenticatedUser(authenticatedIdPData.getUser());
stepConfig.setAuthenticatedIdP(authenticatedIdPData.getIdpName());
stepConfig.setAuthenticatedAutenticator(authenticatedIdPData.getAuthenticator());
}
示例15: getAuthenticatedUser
import org.wso2.carbon.identity.application.authentication.framework.config.model.StepConfig; //导入依赖的package包/类
private AuthenticatedUser getAuthenticatedUser(StepConfig stepConfig, AuthenticationContext context) {
AuthenticatedUser authenticatedUser;
if (stepConfig != null) {
//calling from StepBasedSequenceHandler
authenticatedUser = stepConfig.getAuthenticatedUser();
} else {
//calling from RequestPathBasedSequenceHandler
authenticatedUser = context.getSequenceConfig().getAuthenticatedUser();
}
return authenticatedUser;
}