本文整理汇总了Java中org.opensaml.profile.context.ProfileRequestContext类的典型用法代码示例。如果您正苦于以下问题:Java ProfileRequestContext类的具体用法?Java ProfileRequestContext怎么用?Java ProfileRequestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProfileRequestContext类属于org.opensaml.profile.context包,在下文中一共展示了ProfileRequestContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extAuthnHandlerSetsErrorAttributeWhenIdentificationFails
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
@Test
public void extAuthnHandlerSetsErrorAttributeWhenIdentificationFails() throws Exception {
when(mockAuthenticationHandlerService.buildSession(any()))
.thenReturn(null);
when(mockAuthenticationHandlerService.purgeSession(any()))
.thenReturn(mock(MultivaluedMap.class));
ProfileRequestContext profileRequestContext = new ProfileRequestContext();
profileRequestContext.addSubcontext(new AuthenticationContext());
MockHttpServletRequest request = getQueryParamRequest(getValidTupasResponseParams());
MockHttpServletResponse response = new MockHttpServletResponse();
when(ExternalAuthentication.getProfileRequestContext("e1s1", request)).thenReturn(profileRequestContext);
extAuthnHandler.doGet(request, response);
AuthenticationContext authenticationContext = profileRequestContext.getSubcontext(AuthenticationContext.class);
assertNotNull(authenticationContext);
TupasContext tupasContext = authenticationContext.getSubcontext(TupasContext.class);
assertNull(tupasContext);
assertNotNull(response.getRedirectedUrl());
}
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:23,代码来源:ShibbolethExtAuthnHandlerTest.java
示例2: getAuthenticationResponseContext
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/**
* Helper method to locate authentication response context.
*
* @param ctx
* any context child of profile request context,
* @return Inbound message context or null if not found.
*/
@SuppressWarnings("rawtypes")
private OIDCAuthenticationResponseContext getAuthenticationResponseContext(BaseContext ctx) {
if (ctx == null) {
return null;
}
BaseContext ctxRunner = ctx;
while (ctxRunner.getParent() != null) {
ctxRunner = ctxRunner.getParent();
}
if (ctxRunner instanceof ProfileRequestContext) {
return ((ProfileRequestContext) ctxRunner).getOutboundMessageContext().getSubcontext(
OIDCAuthenticationResponseContext.class, false);
}
return null;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:23,代码来源:AttributeOIDCScopePolicyRule.java
示例3: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
log.error("{} pre-execute failed", getLogPrefix());
return false;
}
if (profileRequestContext.getOutboundMessageContext() == null) {
log.error("{} Unable to locate outbound message context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
}
Object message = profileRequestContext.getOutboundMessageContext().getMessage();
if (message == null || !(message instanceof OIDCClientInformationResponse)) {
log.error("{} Unable to locate outbound message", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
}
response = (OIDCClientInformationResponse) message;
return true;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:24,代码来源:StoreClientInformation.java
示例4: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final Map<String, String> incomingStatements = statementsLookupFunction.apply(profileRequestContext);
if (incomingStatements == null) {
log.debug("{} No incoming metadata statements, nothing to do", getLogPrefix());
return;
}
for (final String foKey : statements.keySet()) {
if (incomingStatements.containsKey(foKey)) {
log.debug("{} Using {} as the federation in the response", getLogPrefix(), foKey);
final JSONObject statement = new JSONObject();
statement.put(foKey, statements.get(foKey));
getOutputMetadata().setCustomField("metadata_statements", statement);
return;
}
}
log.error("{} Could not find any trusted federations from the incoming message", getLogPrefix());
ActionSupport.buildEvent(this, EventIds.INVALID_MESSAGE);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:23,代码来源:AddMetadataStatementToClientMetadata.java
示例5: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (getOidcResponseContext().getIDToken() == null) {
log.error("{} No id token", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return;
}
if (getOidcResponseContext().getAcr() != null) {
log.debug("{} Setting acr to id token", getLogPrefix());
getOidcResponseContext().getIDToken().setACR(getOidcResponseContext().getAcr());
log.debug("{} Updated token {}", getLogPrefix(), getOidcResponseContext().getIDToken().toJSONObject()
.toJSONString());
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:17,代码来源:AddAcrToIDToken.java
示例6: getUnattemptedInactiveFlow
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/**
* Return the first inactive potential flow not found in the intermediate
* flows collection that applies to the request.
*
* @param profileRequestContext
* the current profile request context
* @param authenticationContext
* the current authentication context
* @return an eligible flow, or null
*/
@Nullable
private AuthenticationFlowDescriptor getUnattemptedInactiveFlow(
@Nonnull final ProfileRequestContext profileRequestContext,
@Nonnull final AuthenticationContext authenticationContext) {
for (final AuthenticationFlowDescriptor flow : authenticationContext.getPotentialFlows().values()) {
if (!authenticationContext.getIntermediateFlows().containsKey(flow.getId())) {
if (!authenticationContext.isPassive() || flow.isPassiveAuthenticationSupported()) {
if (flow.apply(profileRequestContext)) {
return flow;
}
}
}
}
return null;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:27,代码来源:SelectAuthenticationFlow.java
示例7: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final RelyingPartyContext rpContext = relyingPartyContextCreationStrategy.apply(profileRequestContext);
if (rpContext == null) {
log.error("{} Unable to locate or create RelyingPartyContext", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
return;
}
log.debug("Attaching RelyingPartyContext for rp {}", clientId.getValue());
rpContext.setRelyingPartyId(clientId.getValue());
final OIDCMetadataContext oidcContext = oidcMetadataContextLookupStrategy.apply(profileRequestContext);
if (oidcContext != null && oidcContext.getClientInformation() != null
&& clientId.equals(oidcContext.getClientInformation().getID())) {
log.debug("{} Setting the rp context verified", getLogPrefix());
rpContext.setVerified(true);
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:20,代码来源:InitializeRelyingPartyContext.java
示例8: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的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);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:23,代码来源:InitializeAuthenticationContext.java
示例9: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
Scope registeredScopes = getMetadataContext().getClientInformation().getMetadata().getScope();
if (registeredScopes == null || registeredScopes.isEmpty()) {
log.debug("{} No registered scopes for client {}, nothing to do", getLogPrefix(),
getMetadataContext().getClientInformation().getID());
return;
}
Scope requestedScopes = scopeLookupStrategy.apply(profileRequestContext);
for (Iterator<Scope.Value> i = requestedScopes.iterator(); i.hasNext();) {
Scope.Value scope = i.next();
if (!registeredScopes.contains(scope)) {
log.warn("{} removing requested scope {} for rp {} as it is not a registered one", getLogPrefix(),
scope.getValue(), getMetadataContext().getClientInformation().getID());
i.remove();
}
}
getOidcResponseContext().setScope(requestedScopes);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:21,代码来源:ValidateScope.java
示例10: setUp
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@BeforeMethod
public void setUp() throws ComponentInitializationException {
message = new MockMessage();
message.getProperties().put("foo", "3");
message.getProperties().put("bar", "1");
message.getProperties().put("baz", "2");
// Encoded mock message, keys sorted alphabetically, per
// MockMessage#toString
expectedMessage = "bar=1&baz=2&foo=3";
messageContext = new MessageContext<>();
messageContext.setMessage(message);
profileCtx = new ProfileRequestContext();
profileCtx.setOutboundMessageContext(messageContext);
encoder = new MockMessageEncoder();
// Note: we don't init the encoder, b/c that is done by the action after
// setting the message context
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:23,代码来源:EncodeMessageTest.java
示例11: doExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final HttpServletResponse servletResponse = getHttpServletResponse();
final Link link = new OIDCWebFingerResponseLinkImpl(request.getRel(), oidcIssuer);
final List<Link> links = new ArrayList<>();
links.add(link);
final OIDCWebFingerResponse response = new OIDCWebFingerResponseImpl(request.getResource(), links);
servletResponse.setContentType("application/jrd+json");
servletResponse.setCharacterEncoding("UTF-8");
final Gson gson = new Gson();
try {
gson.toJson(gson.toJsonTree(response), gson.newJsonWriter(servletResponse.getWriter()));
} catch (IOException e) {
log.error("{} Could not encode the JSON response to the servlet response", getLogPrefix(), e);
return;
}
log.debug("{} WebFinger response successfully applied to the HTTP response", getLogPrefix());
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:21,代码来源:BuildWebFingerResponse.java
示例12: apply
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
@Override
@Nullable
public T apply(@Nullable final ProfileRequestContext input) {
if (input == null || input.getOutboundMessageContext() == null) {
return null;
}
OIDCAuthenticationResponseContext oidcResponseContext = input.getOutboundMessageContext()
.getSubcontext(OIDCAuthenticationResponseContext.class, false);
if (oidcResponseContext == null) {
return null;
}
AuthorizeCodeClaimsSet authzCodeClaims = oidcResponseContext.getAuthorizationCodeClaims();
if (authzCodeClaims == null) {
return null;
}
return doLookup(authzCodeClaims);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:19,代码来源:AbstractAuthzCodeLookupFunction.java
示例13: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
log.error("{} pre-execute failed", getLogPrefix());
return false;
}
final RelyingPartyContext rpc = relyingPartyContextLookupStrategy.apply(profileRequestContext);
if (rpc != null) {
final ProfileConfiguration pc = rpc.getProfileConfig();
if (pc != null && pc instanceof OIDCCoreProtocolConfiguration) {
signedToken = ((OIDCCoreProtocolConfiguration) pc).getSignIDTokens().apply(profileRequestContext);
}
}
return true;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:18,代码来源:FormOutboundAuthenticationResponseMessage.java
示例14: ShibbolethExtAuthnHandlerBuildsSessionOnPost
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
@Test
public void ShibbolethExtAuthnHandlerBuildsSessionOnPost() throws Exception {
when(mockAuthenticationHandlerService.buildSession(any()))
.thenReturn(new TupasIdentification("210281-9988", "TESTAA PORTAALIA", "e1s1"));
ProfileRequestContext profileRequestContext = new ProfileRequestContext();
profileRequestContext.addSubcontext(new AuthenticationContext());
MockHttpServletRequest request = getQueryParamRequest(getValidTupasResponseParams());
request.setParameter("token", "NOT_NULL_ILLOGICAL_MOCK");
MockHttpServletResponse response = new MockHttpServletResponse();
when(ExternalAuthentication.getProfileRequestContext("e1s1", request)).thenReturn(profileRequestContext);
extAuthnHandler.doPost(request, response);
AuthenticationContext authenticationContext = profileRequestContext.getSubcontext(AuthenticationContext.class);
assertNotNull(authenticationContext);
TupasContext tupasContext = authenticationContext.getSubcontext(TupasContext.class);
assertNotNull(tupasContext);
assertEquals("TESTAA PORTAALIA", tupasContext.getCn());
assertEquals("210281-9988", tupasContext.getHetu());
}
开发者ID:vrk-kpa,项目名称:e-identification-tupas-idp-public,代码行数:23,代码来源:ShibbolethExtAuthnHandlerTest.java
示例15: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
log.error("{} pre-execute failed", getLogPrefix());
return false;
}
if (getAuthenticationRequest().getClaims() != null) {
idTokenClaims = getAuthenticationRequest().getClaims().getIDTokenClaims();
}
idTokenHint = getAuthenticationRequest().getIDTokenHint();
if (idTokenClaims == null && idTokenHint == null) {
log.debug("{} No requested claims nor id token hint, nothing to do", getLogPrefix());
return false;
}
return true;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:18,代码来源:SetRequestedSubjectToResponseContext.java
示例16: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
return false;
}
if (profileRequestContext.getInboundMessageContext() == null) {
log.debug("{} No inbound message context associated with this profile request", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
Object message = profileRequestContext.getInboundMessageContext().getMessage();
if (message == null || !(message instanceof OIDCClientRegistrationRequest)) {
log.debug("{} No inbound message associated with this profile request", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return false;
}
request = (OIDCClientRegistrationRequest) message;
return true;
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:22,代码来源:CheckRedirectURIs.java
示例17: testOIDCAuthnRequestNoFlags
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/**
* Test that the action functions properly if the inbound message is a oidc
* authentication request. Check that client id is set to rp ctx.
*/
@Test
public void testOIDCAuthnRequestNoFlags() throws Exception {
AuthenticationRequest req = AuthenticationRequest
.parse("response_type=code&client_id=s6BhdRkqt3&login_hint=foo&redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb&scope=openid%20profile&state=af0ifjsldkj&nonce=n-0S6_WzA2Mj");
final RequestContext requestCtx = new RequestContextBuilder().setInboundMessage(req).buildRequestContext();
@SuppressWarnings("rawtypes")
final ProfileRequestContext prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
final InitializeRelyingPartyContext action = new InitializeRelyingPartyContext();
action.initialize();
final Event event = action.execute(requestCtx);
ActionTestingSupport.assertProceedEvent(event);
RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
Assert.assertEquals(rpCtx.getRelyingPartyId(), "s6BhdRkqt3");
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:20,代码来源:InitializeRelyingPartyContextTest.java
示例18: doSelectRequestedPrincipals
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/**
* Executes the selection process in the presence of specific requested
* Principals, requiring evaluation of potential flows and results for
* Principal-compatibility with request.
*
* @param profileRequestContext
* the current IdP profile request context
* @param authenticationContext
* the current authentication context
*/
private boolean doSelectRequestedPrincipals(@Nonnull final ProfileRequestContext profileRequestContext,
@Nonnull final AuthenticationContext authenticationContext) {
log.debug("{} Specific principals requested with '{}' operator: {}", getLogPrefix(),
requestedPrincipalCtx.getOperator(), requestedPrincipalCtx.getRequestedPrincipals());
if (authenticationContext.getInitialAuthenticationResult() != null
&& authenticationContext.getPotentialFlows().containsKey(
authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId())) {
// Invoke possible SSO but with the initial result as the only
// possible reuse option.
return selectRequestedFlow(profileRequestContext, authenticationContext, Collections.singletonMap(
authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId(),
authenticationContext.getInitialAuthenticationResult()));
} else if (authenticationContext.isForceAuthn()) {
log.debug("{} Forced authentication requested, selecting an inactive flow", getLogPrefix());
return selectRequestedInactiveFlow(profileRequestContext, authenticationContext);
} else if (authenticationContext.getActiveResults().isEmpty()) {
log.debug("{} No active results available, selecting an inactive flow", getLogPrefix());
return selectRequestedInactiveFlow(profileRequestContext, authenticationContext);
} else {
return selectRequestedFlow(profileRequestContext, authenticationContext,
authenticationContext.getActiveResults());
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:36,代码来源:SelectAuthenticationFlow.java
示例19: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
subjectCtx = profileRequestContext.getSubcontext(SubjectContext.class, false);
if (subjectCtx == null) {
log.error("{} No subject context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
idGenerator = idGeneratorLookupStrategy.apply(profileRequestContext);
if (idGenerator == null) {
log.debug("{} No identifier generation strategy", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
return super.doPreExecute(profileRequestContext);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:18,代码来源:SetAuthorizationCodeToResponseContext.java
示例20: doPreExecute
import org.opensaml.profile.context.ProfileRequestContext; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
rpCtx = relyingPartyContextLookupStrategy.apply(profileRequestContext);
if (rpCtx == null) {
log.debug("{} No relying party context associated with this profile request", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
return false;
}
issuerId = issuerLookupStrategy.apply(profileRequestContext);
subjectCtx = profileRequestContext.getSubcontext(SubjectContext.class, false);
if (subjectCtx == null) {
log.error("{} No subject context", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
return super.doPreExecute(profileRequestContext);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:20,代码来源:AddIDTokenShell.java
注:本文中的org.opensaml.profile.context.ProfileRequestContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论