@Override public final void addContextData( String key, String value ) { this.context = context.with(key, value); }
@Override public final void addContextData( String key, String value ) { this.context = context.with(key, value); }
@Override public ExecutionContext authenticate(final Credentials credentials, final String repositoryName, final String workspaceName, final ExecutionContext repositoryContext, final Map<String, Object> sessionAttributes) { if (credentials instanceof ServletCredentials) { return repositoryContext .with(new AnonymousAdminSecurityContext("bypassAdmin")); } return null; }
@Override public ExecutionContext authenticate(Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) { if (credentials instanceof OverrideCredentials) { return repositoryContext.with(new OverrideSecurityContext((OverrideCredentials) credentials)); } else { return null; } }
final void addContextData( String key, String value ) { this.context = context.with(key, value); this.cache.addContextData(key, value); }
final void addContextData( String key, String value ) { this.context = context.with(key, value); this.cache.addContextData(key, value); }
@Override public ExecutionContext authenticate(final Credentials credentials, final String repositoryName, final String workspaceName, final ExecutionContext repositoryContext, final Map<String, Object> sessionAttributes) { if (credentials == null) { return null; } return repositoryContext.with(new ShiroSecurityContext(SecurityUtils.getSubject())); }
@Override public ExecutionContext authenticate(Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) { if (credentials instanceof OverrideCredentials) { return repositoryContext.with(new AdminSecurityContext()); } else { return null; } }
@Override public ExecutionContext authenticate( Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes ) { if (credentials instanceof ServletCredentials) { ServletCredentials creds = (ServletCredentials)credentials; HttpServletRequest request = creds.getRequest(); if (request != null) { return repositoryContext.with(new ServletSecurityContext(request)); } } return null; }
@Override public ExecutionContext authenticate( Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes ) { if (credentials instanceof ServletCredentials) { ServletCredentials creds = (ServletCredentials)credentials; HttpServletRequest request = creds.getRequest(); if (request != null) { return repositoryContext.with(new ServletSecurityContext(request)); } } return null; }
private ExecutionContext getSubjectFromJaas( JaasCredentials credentials, ExecutionContext repositoryContext ) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Looking for an active subject in the JaasCredentials instance..."); } Subject subject = credentials.getLoginContext().getSubject(); if (subject == null) { LOGGER.warn("Cannot authenticate because the JassCredentials instance has a login context with a null subject..."); return null; } return repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject))); }
protected SessionQueryContext( JcrSession session, Locale locale ) { this.session = session; this.executionContext = (locale == null) ? session.context() : session.context().with(locale); this.factories = executionContext.getValueFactories(); }
/** * @see org.modeshape.jcr.security.AuthenticationProvider#authenticate(javax.jcr.Credentials, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext, java.util.Map) */ @Override public ExecutionContext authenticate(Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) { return repositoryContext.with(new MockSecurityContext()); }
protected SessionQueryContext( JcrSession session, Locale locale ) { this.session = session; this.executionContext = (locale == null) ? session.context() : session.context().with(locale); this.factories = executionContext.getValueFactories(); }
/** * @see org.modeshape.jcr.security.JaasProvider#authenticate(javax.jcr.Credentials, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext, java.util.Map) */ @Override public ExecutionContext authenticate(Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) { ExecutionContext ctx = super.authenticate(credentials, repositoryName, workspaceName, repositoryContext, sessionAttributes); if (ctx != null) { return repositoryContext.with(new SrampSecurityContext(ctx.getSecurityContext())); } return ctx; }
private ExecutionContext getPreauthenticatedSubject( ExecutionContext repositoryContext ) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Received null credentials, attempting to search for an active subject on the calling thread via JACC"); } // There are no credentials, so see if there is an authenticated Subject ... Subject subject = Subject.getSubject(AccessController.getContext()); if (subject != null) { // There is, so use this subject ... return repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject))); } subject = jaccSubjectResolver.resolveSubject(); // there are no credentials and we failed to find a pre-authenticated subject, so return null. return subject != null ? repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject))) : null; }
@Override public ExecutionContext authenticate( Credentials credentials, String repositoryName, String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes ) { stringFactory = repositoryContext.getValueFactories().getStringFactory(); return repositoryContext.with(this); }
/** * Create a new importer that will place the content in the supplied destination under the supplied path. * * @param context the context in which the importing should be performed; may not be null * */ public CndImporter( ExecutionContext context ) { assert context != null; this.localRegistry = new LocalNamespaceRegistry(context.getNamespaceRegistry()); this.context = context.with(this.localRegistry); this.valueFactory = new JcrValueFactory(this.context); this.nameFactory = this.context.getValueFactories().getNameFactory(); this.stringFactory = this.context.getValueFactories().getStringFactory(); this.nodeTypes = new LinkedList<NodeTypeDefinition>(); }
/** * Create a new importer that will place the content in the supplied destination under the supplied path. * * @param context the context in which the importing should be performed; may not be null * */ public CndImporter( ExecutionContext context ) { assert context != null; this.localRegistry = new LocalNamespaceRegistry(context.getNamespaceRegistry()); this.context = context.with(this.localRegistry); this.valueFactory = new JcrValueFactory(this.context); this.nameFactory = this.context.getValueFactories().getNameFactory(); this.stringFactory = this.context.getValueFactories().getStringFactory(); this.nodeTypes = new LinkedList<NodeTypeDefinition>(); }
@Test public void shouldCreateSubcontextsWithDifferentIdentifiers() { ExecutionContext newContext = context.with(mock(BinaryStore.class)); assertThat(newContext.getId(), is(not(context.getId()))); } }