本文整理汇总了Java中net.shibboleth.idp.authn.context.AuthenticationContext.setForceAuthn方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationContext.setForceAuthn方法的具体用法?Java AuthenticationContext.setForceAuthn怎么用?Java AuthenticationContext.setForceAuthn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.shibboleth.idp.authn.context.AuthenticationContext
的用法示例。
在下文中一共展示了AuthenticationContext.setForceAuthn方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
log.debug("{} Initializing authentication context", getLogPrefix());
final AuthenticationContext authnCtx = new AuthenticationContext();
if (getAuthenticationRequest().getPrompt() != null) {
authnCtx.setIsPassive(getAuthenticationRequest().getPrompt().contains(Prompt.Type.NONE));
authnCtx.setForceAuthn(getAuthenticationRequest().getPrompt().contains(Prompt.Type.LOGIN));
}
if (getAuthenticationRequest().getLoginHint() != null) {
authnCtx.setHintedName(getAuthenticationRequest().getLoginHint());
}
final AuthenticationContext initialAuthnContext =
profileRequestContext.getSubcontext(AuthenticationContext.class);
if (initialAuthnContext != null) {
authnCtx.setInitialAuthenticationResult(initialAuthnContext.getAuthenticationResult());
}
profileRequestContext.addSubcontext(authnCtx, true);
log.debug("{} Created authentication context: {}", getLogPrefix(), authnCtx);
}
示例2: testRequestPickInactiveInitial
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Test
public void testRequestPickInactiveInitial() {
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
"test2"));
final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
new ExactPrincipalEvalPredicateFactory());
rpc.setOperator("exact");
rpc.setRequestedPrincipals(principals);
authCtx.addSubcontext(rpc, true);
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
authCtx.setActiveResults(Arrays.asList(active));
authCtx.setInitialAuthenticationResult(active);
authCtx.setForceAuthn(true);
authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
action.execute(src);
Assert.assertNull(authCtx.getAuthenticationResult());
Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get("test3"));
}
示例3: testRequestPickActiveInitial
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Test
public void testRequestPickActiveInitial() throws ComponentInitializationException {
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
"test2"));
final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
new ExactPrincipalEvalPredicateFactory());
rpc.setOperator("exact");
rpc.setRequestedPrincipals(principals);
authCtx.addSubcontext(rpc, true);
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
authCtx.setActiveResults(Arrays.asList(active));
authCtx.setInitialAuthenticationResult(active);
authCtx.setForceAuthn(true);
authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
action = new SelectAuthenticationFlow();
action.setFavorSSO(true);
action.initialize();
action.execute(src);
Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
示例4: testNoRequestInitialForced
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Test
public void testNoRequestInitialForced() {
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
authCtx.setForceAuthn(true);
authCtx.setInitialAuthenticationResult(active);
authCtx.setActiveResults(Arrays.asList(active));
final Event event = action.execute(src);
ActionTestingSupport.assertProceedEvent(event);
Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
示例5: testNoRequestForced
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Test
public void testNoRequestForced() {
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
authCtx.setActiveResults(Arrays.asList(active));
authCtx.setForceAuthn(true);
final Event event = action.execute(src);
Assert.assertNull(authCtx.getAuthenticationResult());
Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get(event.getId()));
}
示例6: doExecute
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Nonnull
@Override
protected Event doExecute(@Nonnull final RequestContext springRequestContext,
@Nonnull final ProfileRequestContext profileRequestContext) {
log.debug("{} Building authentication context", getLogPrefix());
final AuthenticationContext ac = new AuthenticationContext();
final OIDCAuthorizationRequestContext authZContext =
profileRequestContext.getSubcontext(OIDCAuthorizationRequestContext.class);
if (authZContext == null) {
log.warn("No authorization request could be located in the profile request context");
return Events.Failure.event(this);
}
final AuthorizationRequest authorizationRequest = authZContext.getAuthorizationRequest();
if (authorizationRequest == null || Strings.isNullOrEmpty(authorizationRequest.getClientId())) {
log.warn("Authorization request could not be loaded from session");
return Events.Failure.event(this);
}
ac.setForceAuthn(authZContext.isForceAuthentication());
if (ac.isForceAuthn()) {
log.debug("Authentication context requires force authN for {}",
authorizationRequest.getClientId());
} else {
log.debug("Authentication context does not require force authN for {}",
authorizationRequest.getClientId());
}
final List<Principal> principals = new ArrayList<>();
processRequestedAcrValuesIfAny(authorizationRequest, principals);
processAcrValuesBasedOnPrincipalWeightMap(principals);
addRequestedPrincipalIntoContext(ac, principals);
profileRequestContext.addSubcontext(ac, true);
profileRequestContext.setBrowserProfile(true);
return Events.Success.event(this);
}
示例7: doExecute
import net.shibboleth.idp.authn.context.AuthenticationContext; //导入方法依赖的package包/类
@Nonnull
@Override
protected Event doExecute(
final @Nonnull RequestContext springRequestContext,
final @Nonnull ProfileRequestContext<ServiceTicketRequest, Object> profileRequestContext){
final ServiceTicketRequest request = FlowStateSupport.getServiceTicketRequest(springRequestContext);
final AuthenticationContext ac = new AuthenticationContext();
ac.setForceAuthn(request.isRenew());
ac.setIsPassive(false);
profileRequestContext.addSubcontext(ac, true);
profileRequestContext.setBrowserProfile(true);
return Events.Proceed.event(this);
}