Skip to content

Commit c846da3

Browse files
committed
Shiro is updated to 3.0.x; some examples are fixed
1 parent e29e13a commit c846da3

20 files changed

Lines changed: 345 additions & 372 deletions

File tree

‎phonebook/pom.xml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@
7676
</dependency>
7777
<dependency>
7878
<groupId>org.hibernate.orm</groupId>
79-
<artifactId>hibernate-ehcache</artifactId>
79+
<artifactId>hibernate-jcache</artifactId>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.ehcache</groupId>
83+
<artifactId>ehcache</artifactId>
84+
<classifier>jakarta</classifier>
8085
</dependency>
8186
<dependency>
8287
<groupId>org.javassist</groupId>

‎phonebook/src/main/java/wicket/contrib/phonebook/web/BasePhonebookApplication.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public Class<? extends Page> getHomePage()
3939
@Override
4040
protected void init()
4141
{
42+
getCspSettings().blocking().disabled();
4243
super.init();
4344

4445
getComponentInstantiationListeners().add(new SpringComponentInjector(this, context(), true));

‎phonebook/src/main/resources/persistence.hibernate.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<beans>
55

66
<!-- setup hibernate session factory -->
7-
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
7+
<bean id="sessionFactory" class="org.springframework.orm.jpa.hibernate.LocalSessionFactoryBean">
88
<property name="dataSource" ref="dataSource"/>
99
<property name="mappingResources">
1010
<list>
@@ -20,14 +20,14 @@
2020
<prop key="hibernate.show_sql">true</prop>
2121
<prop key="hibernate.format_sql">true</prop>
2222
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
23-
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
23+
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.jcache.internal.JCacheRegionFactory</prop>
2424
<prop key="hibernate.cache.use_query_cache">true</prop>
2525
</props>
2626
</property>
2727
</bean>
2828

2929
<!-- setup transaction manager -->
30-
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
30+
<bean id="transactionManager" class="org.springframework.orm.jpa.hibernate.HibernateTransactionManager">
3131
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
3232
</bean>
3333

‎phonebook/src/main/webapp/WEB-INF/web.xml‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111
<param-value>classpath:applicationContext.xml</param-value>
1212
</context-param>
1313

14-
15-
<!-- Enable the filters for Hibernate -->
16-
17-
<filter>
18-
<filter-name>opensessioninview</filter-name>
19-
<filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>
20-
</filter>
21-
<!-- END hibernate filters -->
22-
23-
2414
<filter>
2515
<filter-name>phonebook</filter-name>
2616
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
@@ -30,13 +20,6 @@
3020
</init-param>
3121
</filter>
3222

33-
<!-- Enable the filters for Hibernate -->
34-
<filter-mapping>
35-
<filter-name>opensessioninview</filter-name>
36-
<url-pattern>/hibernate/*</url-pattern>
37-
</filter-mapping>
38-
<!-- END hibernate filters -->
39-
4023
<filter-mapping>
4124
<filter-name>phonebook</filter-name>
4225
<url-pattern>/hibernate/*</url-pattern>

‎pom.xml‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
<extensions>true</extensions>
121121
<configuration>
122122
<publishingServerId>central-sonatype-repo</publishingServerId>
123+
<checksums>required</checksums>
123124
<autoPublish>true</autoPublish>
124125
<excludeArtifacts>
125126
<artifactId>wicketstuff-offline-mode-examples</artifactId>
@@ -328,13 +329,12 @@
328329
<deployment.disabled>false</deployment.disabled>
329330
<sources.disabled>false</sources.disabled>
330331

331-
<hibernate.version>7.4.6.Final</hibernate.version>
332-
<hibernate-ehcache.version>6.0.0.Alpha7</hibernate-ehcache.version>
332+
<hibernate.version>7.4.7.Final</hibernate.version>
333333
<hibernate-validator.version>9.1.3.Final</hibernate-validator.version>
334334
<javassist.version>3.33.0-GA</javassist.version>
335335
<jetty.version>12.1.12</jetty.version>
336336
<sf-jung.version>2.1.1</sf-jung.version>
337-
<shiro.version>2.2.1</shiro.version>
337+
<shiro.version>3.0.1</shiro.version>
338338
<slf4j.version>2.0.18</slf4j.version>
339339
<logback.version>1.6.3</logback.version>
340340
<log4j.version>2.26.1</log4j.version>
@@ -346,7 +346,7 @@
346346
<poi.version>5.5.1</poi.version>
347347
<guava.version>33.7.1-jre</guava.version>
348348
<wicket-webjars.version>4.0.14</wicket-webjars.version>
349-
<jquery-selectors.version>4.0.14</jquery-selectors.version>
349+
<jquery-selectors.version>4.0.15</jquery-selectors.version>
350350
<xstream.version>1.4.21</xstream.version>
351351
<hamcrest.version>3.0</hamcrest.version>
352352
<jakarta.servlet-api.version>6.0.0</jakarta.servlet-api.version> <!-- MUST be aligned with Wicket -->
@@ -782,8 +782,8 @@
782782
</dependency>
783783
<dependency>
784784
<groupId>org.hibernate.orm</groupId>
785-
<artifactId>hibernate-ehcache</artifactId>
786-
<version>${hibernate-ehcache.version}</version>
785+
<artifactId>hibernate-jcache</artifactId>
786+
<version>${hibernate.version}</version>
787787
</dependency>
788788
<dependency>
789789
<groupId>org.hibernate.validator</groupId>
@@ -797,11 +797,6 @@
797797
<artifactId>shiro-core</artifactId>
798798
<version>${shiro.version}</version>
799799
</dependency>
800-
<dependency>
801-
<groupId>org.apache.shiro</groupId>
802-
<artifactId>shiro-ehcache</artifactId>
803-
<version>${shiro.version}</version>
804-
</dependency>
805800
<dependency>
806801
<groupId>org.apache.shiro</groupId>
807802
<artifactId>shiro-spring</artifactId>
@@ -915,7 +910,14 @@
915910
<dependency>
916911
<groupId>org.ehcache</groupId>
917912
<artifactId>ehcache</artifactId>
913+
<classifier>jakarta</classifier>
918914
<version>${ehcache.version}</version>
915+
<exclusions>
916+
<exclusion>
917+
<groupId>org.glassfish.jaxb</groupId>
918+
<artifactId>jaxb-runtime</artifactId>
919+
</exclusion>
920+
</exclusions>
919921
</dependency>
920922
<dependency>
921923
<groupId>net.sf.shadesdb</groupId>

‎shiro-security/wicket-shiro-examples/shiro-example-base/src/main/java/org/wicketstuff/shiro/example/ExampleApplication.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
2929
import org.wicketstuff.shiro.page.LogoutPage;
3030

3131
/**
32-
*
32+
*
3333
*/
3434
public abstract class ExampleApplication extends WebApplication
3535
{
3636

3737
@Override
3838
protected void init()
3939
{
40+
getCspSettings().blocking().disabled();
4041
getMarkupSettings().setStripWicketTags(true);
4142

4243
// Configure Shiro

‎shiro-security/wicket-shiro-examples/shiro-example-base/src/main/resources/log4j.properties‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ log4j.logger.org.apache.wicket=INFO
88
log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
99
log4j.logger.org.apache.wicket.version=INFO
1010
log4j.logger.org.apache.wicket.RequestCycle=INFO
11-
12-

‎shiro-security/wicket-shiro-examples/shiro-example-realm/src/main/java/org/wicketstuff/shiro/example/realm/SillyRealm.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public SillyRealm()
6161
* <p/>
6262
* All that is required is that the account information include directly the credentials found
6363
* in the EIS.
64-
*
64+
*
6565
* @param username
6666
* the username for the account data to retrieve
6767
* @return the Account information corresponding to the specified username:
@@ -121,7 +121,7 @@ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principal
121121

122122
// get only the principals that this realm cares about:
123123
@SuppressWarnings("unchecked")
124-
Collection<String> thisRealmPrincipals = principals.fromRealm(getName());
124+
Collection<String> thisRealmPrincipals = (Collection<String>)principals.fromRealm(getName());
125125
if (thisRealmPrincipals == null || thisRealmPrincipals.isEmpty())
126126
{
127127
return null;

‎shiro-security/wicket-shiro-examples/shiro-example-realm/src/main/resources/log4j.properties‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ log4j.logger.org.apache.wicket=INFO
88
log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
99
log4j.logger.org.apache.wicket.version=INFO
1010
log4j.logger.org.apache.wicket.RequestCycle=INFO
11-
12-

‎shiro-security/wicket-shiro-examples/shiro-example-realm/src/main/webapp/WEB-INF/web.xml‎

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,55 @@
44
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
55
version="6.0">
66

7-
<context-param>
8-
<param-name>configuration</param-name>
9-
<param-value>development</param-value>
10-
</context-param>
11-
12-
<display-name>Shiro Security for Apache Wicket Example</display-name>
13-
14-
<context-param>
15-
<param-name>log4jConfigLocation</param-name>
16-
<param-value>classpath:log4j.properties</param-value>
17-
</context-param>
18-
19-
<filter>
20-
<filter-name>ShiroFilter</filter-name>
21-
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
22-
<init-param>
23-
<param-name>config</param-name>
24-
<param-value>
25-
# The ShiroFilter configuration is very powerful and flexible, while still remaining succinct.
26-
# Please read the comprehensive example, with full comments and explanations, in the JavaDoc:
27-
#
28-
# http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
29-
30-
[main]
31-
stupidRealm = org.wicketstuff.shiro.example.realm.SillyRealm
32-
</param-value>
33-
</init-param>
34-
</filter>
35-
<filter>
36-
<filter-name>WicketFilter</filter-name>
37-
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
38-
<init-param>
39-
<param-name>applicationClassName</param-name>
40-
<param-value>org.wicketstuff.shiro.example.realm.RealmExampleApp</param-value>
41-
</init-param>
42-
</filter>
43-
44-
<filter-mapping>
45-
<filter-name>ShiroFilter</filter-name>
46-
<url-pattern>/*</url-pattern>
47-
</filter-mapping>
48-
<filter-mapping>
49-
<filter-name>WicketFilter</filter-name>
50-
<url-pattern>/*</url-pattern>
51-
</filter-mapping>
52-
53-
<welcome-file-list>
54-
<welcome-file>index.jsp</welcome-file>
55-
<welcome-file>index.htm</welcome-file>
56-
<welcome-file>index.shtml</welcome-file>
57-
</welcome-file-list>
58-
7+
<context-param>
8+
<param-name>configuration</param-name>
9+
<param-value>development</param-value>
10+
</context-param>
11+
12+
<display-name>Shiro Security for Apache Wicket Example</display-name>
13+
14+
<context-param>
15+
<param-name>log4jConfigLocation</param-name>
16+
<param-value>classpath:log4j.properties</param-value>
17+
</context-param>
18+
19+
<filter>
20+
<filter-name>ShiroFilter</filter-name>
21+
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
22+
<init-param>
23+
<param-name>config</param-name>
24+
<param-value>
25+
# The ShiroFilter configuration is very powerful and flexible, while still remaining succinct.
26+
# Please read the comprehensive example, with full comments and explanations, in the JavaDoc:
27+
#
28+
# http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
29+
30+
[main]
31+
stupidRealm = org.wicketstuff.shiro.example.realm.SillyRealm
32+
</param-value>
33+
</init-param>
34+
</filter>
35+
<filter>
36+
<filter-name>WicketFilter</filter-name>
37+
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
38+
<init-param>
39+
<param-name>applicationClassName</param-name>
40+
<param-value>org.wicketstuff.shiro.example.realm.RealmExampleApp</param-value>
41+
</init-param>
42+
</filter>
43+
44+
<filter-mapping>
45+
<filter-name>ShiroFilter</filter-name>
46+
<url-pattern>/*</url-pattern>
47+
</filter-mapping>
48+
<filter-mapping>
49+
<filter-name>WicketFilter</filter-name>
50+
<url-pattern>/*</url-pattern>
51+
</filter-mapping>
52+
53+
<welcome-file-list>
54+
<welcome-file>index.jsp</welcome-file>
55+
<welcome-file>index.htm</welcome-file>
56+
<welcome-file>index.shtml</welcome-file>
57+
</welcome-file-list>
5958
</web-app>

0 commit comments

Comments
 (0)