This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"shop" : { | |
"_routing" : { | |
"required" : true | |
}, | |
"properties" : { | |
"id" : { | |
"type" : "long" | |
}, | |
"created_date" : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"top_children": { | |
"type": "shop", | |
"query": { | |
"term": { | |
"price": 25.23 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"top_children": { | |
"type": "shop", | |
"query": { | |
"term": { | |
"price": 25.23 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager" | |
p:realm-ref="onyxRealm"> | |
<property name="cacheManager"> | |
<bean class="org.apache.shiro.cache.MemoryConstrainedCacheManager" /> | |
</property> | |
<property name="sessionManager"> | |
<bean class="org.apache.shiro.session.mgt.DefaultSessionManager" | |
p:sessionDAO-ref="coreSessionDAO" /> | |
</property> | |
</bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:p="http://www.springframework.org/schema/p" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | |
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean" | |
p:securityManager-ref="webSecurityManager" | |
p:loginUrl="/login" | |
p:successUrl="/accounts/profile"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> | |
<property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/> | |
<property name="arguments" ref="webSecurityManager"/> | |
</bean> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AuthenticationFilter extends SFSExtensionFilter { | |
@Override | |
public void destroy() {} | |
@Override | |
public FilterAction handleClientRequest(String s, User user, ISFSObject object) throws SFSException { | |
ThreadState state = new SubjectThreadState(ShiroUtils.getSubject(user.getSession())); | |
//how to unbind it later? | |
state.bind(); | |
return FilterAction.CONTINUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Incorrect initialization | |
*/ | |
public class MyContextLoaderListener extends ContextLoaderListener { | |
@Override | |
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) { | |
applicationContext.setParent(MySingleton.getContext()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setSessionMode(String sessionMode) { | |
String mode = sessionMode; | |
if (mode == null) { | |
throw new IllegalArgumentException("sessionMode argument cannot be null."); | |
} | |
mode = sessionMode.toLowerCase(); | |
if (!HTTP_SESSION_MODE.equals(mode) && !NATIVE_SESSION_MODE.equals(mode)) { | |
String msg = "Invalid sessionMode [" + sessionMode + "]. Allowed values are " + | |
"public static final String constants in the " + getClass().getName() + " class: '" | |
+ HTTP_SESSION_MODE + "' or '" + NATIVE_SESSION_MODE + "', with '" + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//True hardcode to allow to define manager in spring | |
public class MyWebSecurityManager extends DefaultWebSecurityManager { | |
private SessionManager savedSessionManager; | |
@Override | |
protected SessionManager createSessionManager(String sessionMode) { | |
return savedSessionManager; | |
} |
OlderNewer