You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/08/03 14:17:35 UTC
svn commit: r682144 [2/4] - in
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki:
auth/authorize/ auth/login/ auth/permissions/ auth/user/ content/
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModule.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModule.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAssertionLoginModule.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -34,7 +35,6 @@
import com.ecyrd.jspwiki.TextUtil;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
-import com.ecyrd.jspwiki.auth.authorize.Role;
import com.ecyrd.jspwiki.util.HttpUtil;
/**
@@ -52,9 +52,7 @@
* </ol>
* <p>
* After authentication, a generic WikiPrincipal based on the username will be
- * created and associated with the Subject. Principals
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#ALL} and
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#ASSERTED} will be added.
+ * created and associated with the Subject.
* </p>
* @see javax.security.auth.spi.LoginModule#commit()
* @see CookieAuthenticationLoginModule
@@ -77,23 +75,14 @@
* Logs in the user by calling back to the registered CallbackHandler with
* an HttpRequestCallback. The CallbackHandler must supply the current
* servlet HTTP request as its response.
- * @return the result of the login; if the subject Principal set already
- * possesses {@link Role#AUTHENTICATED}, always returns <code>false</code>
- * to indicate that this module should be ignored. Otherwise, if a cookie is
+ * @return the result of the login; if a cookie is
* found, this method returns <code>true</code>. If not found, this
* method throws a <code>FailedLoginException</code>.
* @see javax.security.auth.spi.LoginModule#login()
+ * @throws {@inheritDoc}
*/
public boolean login() throws LoginException
{
- // Ignore this module if already authenticated
- if ( m_subject.getPrincipals().contains( Role.AUTHENTICATED ) )
- {
- // If login ignored, remove asserted role
- m_principalsToRemove.add( Role.ASSERTED );
- return false;
- }
-
// Otherwise, let's go and look for the cookie!
HttpRequestCallback hcb = new HttpRequestCallback();
Callback[] callbacks = new Callback[]
@@ -104,7 +93,7 @@
HttpServletRequest request = hcb.getRequest();
HttpSession session = ( request == null ) ? null : request.getSession( false );
String sid = ( session == null ) ? NULL : session.getId();
- String name = getUserCookie( request );
+ String name = (request != null) ? getUserCookie( request ) : null;
if ( name == null )
{
if ( log.isDebugEnabled() )
@@ -116,20 +105,10 @@
if ( log.isDebugEnabled() )
{
- log.debug( "Logged in session ID=" + sid );
- log.debug( "Added Principals " + name + ",Role.ASSERTED,Role.ALL" );
+ log.debug( "Logged in session ID=" + sid + "; asserted=" + name );
}
// If login succeeds, commit these principals/roles
m_principals.add( new WikiPrincipal( name, WikiPrincipal.FULL_NAME ) );
- m_principals.add( Role.ASSERTED );
- m_principals.add( Role.ALL );
-
- // If login succeeds, overwrite these principals/roles
- m_principalsToOverwrite.add( WikiPrincipal.GUEST );
- m_principalsToOverwrite.add( Role.ANONYMOUS );
-
- // If login fails, remove these roles
- m_principalsToRemove.add( Role.ASSERTED );
return true;
}
catch( IOException e )
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAuthenticationLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAuthenticationLoginModule.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAuthenticationLoginModule.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/CookieAuthenticationLoginModule.java Sun Aug 3 05:17:34 2008
@@ -1,25 +1,27 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
import java.io.*;
+import java.util.UUID;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.UnsupportedCallbackException;
@@ -29,14 +31,11 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
-import org.safehaus.uuid.UUID;
-import org.safehaus.uuid.UUIDGenerator;
import com.ecyrd.jspwiki.FileUtil;
import com.ecyrd.jspwiki.TextUtil;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
-import com.ecyrd.jspwiki.auth.authorize.Role;
import com.ecyrd.jspwiki.util.HttpUtil;
/**
@@ -60,13 +59,10 @@
* </ol>
* <p>
* After authentication, a generic WikiPrincipal based on the username will be
- * created and associated with the Subject. Principals
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#ALL} and
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#AUTHENTICATED} will be added.
+ * created and associated with the Subject.
* </p>
* @see javax.security.auth.spi.LoginModule#commit()
* @see CookieAssertionLoginModule
- * @author Janne Jalkanen
* @since 2.5.62
*/
public class CookieAuthenticationLoginModule extends AbstractLoginModule
@@ -82,7 +78,7 @@
* User property for setting how long the cookie is stored on the user's computer.
* The value is {@value}. The default expiry time is 14 days.
*/
- public static final String PROP_LOGIN_EXPIRY_DAYS = "jspwiki.cookieAuthorization.expiry";
+ public static final String PROP_LOGIN_EXPIRY_DAYS = "jspwiki.cookieAuthentication.expiry";
/**
* Built-in value for storing the cookie.
@@ -97,6 +93,8 @@
/**
* @see javax.security.auth.spi.LoginModule#login()
+ *
+ * {@inheritDoc}
*/
public boolean login() throws LoginException
{
@@ -126,24 +124,16 @@
try
{
- in = new FileReader( cookieFile );
+ in = new BufferedReader( new InputStreamReader( new FileInputStream( cookieFile ), "UTF-8" ) );
String username = FileUtil.readContents( in );
if ( log.isDebugEnabled() )
{
- log.debug( "Logged in loginName=" + username );
- log.debug( "Added Principals Role.AUTHENTICATED,Role.ALL" );
+ log.debug( "Logged in cookie authenticated name=" + username );
}
// If login succeeds, commit these principals/roles
- m_principals.add( new PrincipalWrapper( new WikiPrincipal( username, WikiPrincipal.LOGIN_NAME ) ) );
- m_principals.add( Role.AUTHENTICATED );
- m_principals.add( Role.ALL );
-
- // If login succeeds, overwrite these principals/roles
- m_principalsToOverwrite.add( WikiPrincipal.GUEST );
- m_principalsToOverwrite.add( Role.ANONYMOUS );
- m_principalsToOverwrite.add( Role.ASSERTED );
+ m_principals.add( new WikiPrincipal( username, WikiPrincipal.LOGIN_NAME ) );
//
// Tag the file so that we know that it has been accessed recently.
@@ -252,7 +242,7 @@
// get rid of jug.jar
public static void setLoginCookie( WikiEngine engine, HttpServletResponse response, String username )
{
- UUID uid = UUIDGenerator.getInstance().generateRandomBasedUUID();
+ UUID uid = UUID.randomUUID();
int days = TextUtil.getIntegerProperty( engine.getWikiProperties(),
PROP_LOGIN_EXPIRY_DAYS,
@@ -267,7 +257,10 @@
try
{
- out = new FileWriter(cf);
+ //
+ // Write the cookie content to the cookie store file.
+ //
+ out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(cf), "UTF-8" ) );
FileUtil.copyContents( new StringReader(username), out );
if( log.isDebugEnabled() )
@@ -336,7 +329,7 @@
File[] files = cookieDir.listFiles();
- long obsoleteDateLimit = System.currentTimeMillis() - (days+1) * 24 * 60 * 60 * 1000L;
+ long obsoleteDateLimit = System.currentTimeMillis() - ((long)days+1) * 24 * 60 * 60 * 1000L;
int deleteCount = 0;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/HttpRequestCallback.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/HttpRequestCallback.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/HttpRequestCallback.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/HttpRequestCallback.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -26,8 +27,8 @@
* Callback for requesting and supplying a HttpServletRequest required by a
* LoginModule. This Callback is used by LoginModules needing access to the
* servlet request.
- * @link javax.servlet.http.HttpServletRequest#getUserPrincipal() or
- * @link javax.servlet.http.HttpServletRequest#getRemoteUser() methods.
+ * @see javax.servlet.http.HttpServletRequest#getUserPrincipal() or
+ * @see javax.servlet.http.HttpServletRequest#getRemoteUser() methods.
* @author Andrew Jaquith
* @since 2.3
*/
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/PrincipalWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/PrincipalWrapper.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/PrincipalWrapper.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/PrincipalWrapper.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -34,7 +35,7 @@
/**
* Constructs a new instance of this class by wrapping (decorating)
* the supplied principal.
- * @param principal
+ * @param principal The principal to wrap
*/
public PrincipalWrapper( Principal principal )
{
@@ -52,6 +53,8 @@
/**
* Returns the name of the wrapped principal.
+ *
+ * @return The name of the wrapped principal.
*/
public final String getName()
{
@@ -59,9 +62,13 @@
}
/**
- * Two PrincipalWrapper objects are equal if their internally-wrapped
- * principals are also equal.
+ * Two PrincipalWrapper objects are equal if their internally-wrapped
+ * principals are also equal.
+ *
+ * @param obj {@inheritDoc}
+ * @return True, if the wrapped object is also equal to our wrapped object.
*/
+ @Override
public boolean equals( Object obj )
{
if ( ! ( obj instanceof PrincipalWrapper ) )
@@ -71,6 +78,12 @@
return m_principal.equals( ( (PrincipalWrapper)obj ).getPrincipal() );
}
+ /**
+ * The hashcode is based on the hashcode of the wrapped principal.
+ *
+ * @return A hashcode.
+ */
+ @Override
public int hashCode()
{
return m_principal.hashCode() * 13;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseCallback.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseCallback.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseCallback.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseCallback.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -54,4 +55,4 @@
this.m_database = database;
}
-}
\ No newline at end of file
+}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseLoginModule.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseLoginModule.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/UserDatabaseLoginModule.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -32,7 +33,6 @@
import com.ecyrd.jspwiki.auth.NoSuchPrincipalException;
import com.ecyrd.jspwiki.auth.WikiPrincipal;
-import com.ecyrd.jspwiki.auth.authorize.Role;
import com.ecyrd.jspwiki.auth.user.UserDatabase;
import com.ecyrd.jspwiki.auth.user.UserProfile;
@@ -53,9 +53,6 @@
* <p>
* After authentication, a Principals based on the login name will be created
* and associated with the Subject.
- * Also, principals {@link com.ecyrd.jspwiki.auth.authorize.Role#ALL} and
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#AUTHENTICATED} will be added to
- * the Subject's principal set.
* </p>
* @author Andrew Jaquith
* @since 2.3
@@ -67,6 +64,8 @@
/**
* @see javax.security.auth.spi.LoginModule#login()
+ *
+ * {@inheritDoc}
*/
public boolean login() throws LoginException
{
@@ -93,22 +92,11 @@
{
if ( log.isDebugEnabled() )
{
- log.debug( "Logged in loginName=" + username );
- log.debug( "Added Principals Role.AUTHENTICATED,Role.ALL" );
+ log.debug( "Logged in user database user " + username );
}
// If login succeeds, commit these principals/roles
- m_principals.add( new PrincipalWrapper( new WikiPrincipal( username, WikiPrincipal.LOGIN_NAME ) ) );
- m_principals.add( Role.AUTHENTICATED );
- m_principals.add( Role.ALL );
-
- // If login succeeds, overwrite these principals/roles
- m_principalsToOverwrite.add( WikiPrincipal.GUEST );
- m_principalsToOverwrite.add( Role.ANONYMOUS );
- m_principalsToOverwrite.add( Role.ASSERTED );
-
- // If login fails, remove these roles
- m_principalsToRemove.add( Role.AUTHENTICATED );
+ m_principals.add( new WikiPrincipal( username, WikiPrincipal.LOGIN_NAME ) );
return true;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerCallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerCallbackHandler.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerCallbackHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerCallbackHandler.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -31,7 +32,7 @@
/**
* Handles logins made from within JSPWiki.
- * @link AuthenticationManager#getWikiSession(HttpServletRequest).
+ * @see com.ecyrd.jspwiki.WikiSession#getWikiSession(WikiEngine,HttpServletRequest)
* @author Andrew Jaquith
* @since 2.3
*/
@@ -43,6 +44,13 @@
private final WikiEngine m_engine;
+ /**
+ * Create a new handler.
+ *
+ * @param engine The WikiEngine
+ * @param request The request to look into
+ * @param authorizer The authorizer which does all these things.
+ */
public WebContainerCallbackHandler( WikiEngine engine, HttpServletRequest request, Authorizer authorizer )
{
m_engine = engine;
@@ -52,6 +60,8 @@
/**
* @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+ *
+ * {@inheritDoc}
*/
public final void handle( Callback[] callbacks ) throws IOException, UnsupportedCallbackException
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerLoginModule.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerLoginModule.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WebContainerLoginModule.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -60,10 +61,8 @@
* the value of getRemoteUser</li>
* </ol>
* <p>
- * After authentication, the Subject will contain principals
- * {@link com.ecyrd.jspwiki.auth.authorize.Role#ALL}
- * and {@link com.ecyrd.jspwiki.auth.authorize.Role#AUTHENTICATED},
- * plus the Principal that represents the logged-in user.</p>
+ * After authentication, the Subject will contain the Principal that
+ * represents the logged-in user.</p>
*
* @author Andrew Jaquith
* @since 2.3
@@ -76,6 +75,9 @@
/**
* Logs in the user.
* @see javax.security.auth.spi.LoginModule#login()
+ *
+ * @return {@inheritDoc}
+ * @throws {@inheritDoc}
*/
public boolean login() throws LoginException
{
@@ -118,25 +120,13 @@
}
if ( log.isDebugEnabled() )
{
- log.debug("Added Principal " + principal.getName() + ",Role.ANONYMOUS,Role.ALL" );
+ log.debug("Logged in container principal " + principal.getName() + "." );
}
- m_principals.add( new PrincipalWrapper( principal ) );
+ m_principals.add( principal );
// Add any container roles
injectWebAuthorizerRoles( acb.getAuthorizer(), request );
- // If login succeeds, commit these roles
- m_principals.add( Role.AUTHENTICATED );
- m_principals.add( Role.ALL );
-
- // If login succeeds, remove these principals/roles
- m_principalsToOverwrite.add( WikiPrincipal.GUEST );
- m_principalsToOverwrite.add( Role.ANONYMOUS );
- m_principalsToOverwrite.add( Role.ASSERTED );
-
- // If login fails, remove these roles
- m_principalsToRemove.add( Role.AUTHENTICATED );
-
return true;
}
catch( IOException e )
@@ -164,7 +154,7 @@
private final void injectWebAuthorizerRoles( Authorizer authorizer, HttpServletRequest request )
{
Principal[] roles = authorizer.getRoles();
- Set foundRoles = new HashSet();
+ Set<Principal> foundRoles = new HashSet<Principal>();
if ( authorizer instanceof WebAuthorizer )
{
WebAuthorizer wa = (WebAuthorizer)authorizer;
@@ -175,7 +165,7 @@
foundRoles.add( roles[i] );
if ( log.isDebugEnabled() )
{
- log.debug("Added Principal " + roles[i].getName() + "." );
+ log.debug("Added container role " + roles[i].getName() + "." );
}
}
}
@@ -183,9 +173,6 @@
// Add these container roles if login succeeds
m_principals.addAll( foundRoles );
-
- // Make sure the same ones are removed if login fails
- m_principalsToRemove.addAll( foundRoles );
}
-}
\ No newline at end of file
+}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiCallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiCallbackHandler.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiCallbackHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiCallbackHandler.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -47,6 +48,13 @@
private final String m_username;
+ /**
+ * Create a new callback handler.
+ *
+ * @param database The Userdatabase to use
+ * @param username The username
+ * @param password The password
+ */
public WikiCallbackHandler( UserDatabase database, String username, String password )
{
m_database = database;
@@ -56,6 +64,8 @@
/**
* @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
+ *
+ * {@inheritDoc}
*/
public void handle( Callback[] callbacks ) throws IOException, UnsupportedCallbackException
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiEngineCallback.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiEngineCallback.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiEngineCallback.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/WikiEngineCallback.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.login;
@@ -27,7 +28,7 @@
* Callback for requesting and supplying the WikiEngine object required by a
* LoginModule. This Callback is used by LoginModules needing access to the
* external authorizer or group manager.
- * @author Janne Jalkanen
+ *
* @since 2.5
*/
public class WikiEngineCallback implements Callback
@@ -53,5 +54,4 @@
{
return m_engine;
}
-
-}
\ No newline at end of file
+}
Added: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/package.html
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/package.html?rev=682144&view=auto
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/package.html (added)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/login/package.html Sun Aug 3 05:17:34 2008
@@ -0,0 +1,14 @@
+
+<body>
+
+Provides the different login modules that JSPWiki uses.
+
+<h3>Package Specification</h3>
+
+TBD
+
+<h3>Related Documentation</h3>
+
+TBD
+
+</body>
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermission.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermission.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermission.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermission.java Sun Aug 3 05:17:34 2008
@@ -1,24 +1,26 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.permissions;
+import java.io.Serializable;
import java.security.Permission;
import java.security.PermissionCollection;
@@ -29,7 +31,7 @@
* @author Andrew Jaquith
* @since 2.3.80
*/
-public final class AllPermission extends Permission
+public final class AllPermission extends Permission implements Serializable
{
private static final long serialVersionUID = 1L;
@@ -37,6 +39,12 @@
private final String m_wiki;
+ /** For serialization purposes. */
+ protected AllPermission()
+ {
+ this(null);
+ }
+
/**
* Creates a new AllPermission for the given wikis.
*
@@ -52,6 +60,9 @@
/**
* Two AllPermission objects are considered equal if their wikis are equal.
* @see java.lang.Object#equals(java.lang.Object)
+ *
+ * @return {@inheritDoc}
+ * @param obj {@inheritDoc}
*/
public final boolean equals( Object obj )
{
@@ -66,6 +77,8 @@
/**
* No-op; always returns <code>null</code>
* @see java.security.Permission#getActions()
+ *
+ * @return Always null.
*/
public final String getActions()
{
@@ -75,7 +88,7 @@
/**
* Returns the name of the wiki containing the page represented by this
* permission; may return the wildcard string.
- * @return the wiki
+ * @return The wiki
*/
public final String getWiki()
{
@@ -85,6 +98,8 @@
/**
* Returns the hash code for this WikiPermission.
* @see java.lang.Object#hashCode()
+ *
+ * @return {@inheritDoc}
*/
public final int hashCode()
{
@@ -134,6 +149,8 @@
/**
* Returns a new {@link AllPermissionCollection}.
* @see java.security.Permission#newPermissionCollection()
+ *
+ * @return {@inheritDoc}
*/
public PermissionCollection newPermissionCollection()
{
@@ -143,12 +160,19 @@
/**
* Prints a human-readable representation of this permission.
* @see java.lang.Object#toString()
+ * @return {@inheritDoc}
*/
public final String toString()
{
return "(\"" + this.getClass().getName() + "\",\"" + m_wiki + "\")";
}
+ /**
+ * Checks if the given permission is one of ours.
+ *
+ * @param permission Permission to check
+ * @return true, if the permission is a JSPWiki permission; false otherwise.
+ */
protected static final boolean isJSPWikiPermission( Permission permission )
{
return permission instanceof WikiPermission ||
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermissionCollection.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermissionCollection.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermissionCollection.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/AllPermissionCollection.java Sun Aug 3 05:17:34 2008
@@ -1,21 +1,22 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.permissions;
@@ -37,7 +38,7 @@
private boolean m_readOnly = false;
- protected final Hashtable m_permissions = new Hashtable();
+ protected final Hashtable<Permission, Permission> m_permissions = new Hashtable<Permission, Permission>();
/**
* Adds an AllPermission object to this AllPermissionCollection. If this
@@ -45,7 +46,10 @@
* is not of type {@link AllPermission}, a {@link SecurityException} is
* thrown.
* @see java.security.PermissionCollection#add(java.security.Permission)
+ *
+ * @param permission {@inheritDoc}
*/
+ @Override
public void add( Permission permission )
{
if ( !AllPermission.isJSPWikiPermission( permission ) )
@@ -70,8 +74,11 @@
* Returns an enumeration of all AllPermission objects stored in this
* collection.
* @see java.security.PermissionCollection#elements()
+ *
+ * @return {@inheritDoc}
*/
- public Enumeration elements()
+ @Override
+ public Enumeration<Permission> elements()
{
return m_permissions.elements();
}
@@ -89,6 +96,8 @@
* but only the AllPermission, PagePermission or WikiPermission types are
* actually evaluated.
* @see java.security.PermissionCollection#implies(java.security.Permission)
+ *
+ * @return {@inheritDoc}
*/
public boolean implies( Permission permission )
{
@@ -105,10 +114,10 @@
}
// Step through each AllPermission
- Enumeration permEnum = m_permissions.elements();
+ Enumeration<Permission> permEnum = m_permissions.elements();
while( permEnum.hasMoreElements() )
{
- Permission storedPermission = (Permission) permEnum.nextElement();
+ Permission storedPermission = permEnum.nextElement();
if ( storedPermission.implies( permission ) )
{
return true;
@@ -118,7 +127,7 @@
}
/**
- * @see java.security.PermissionCollection#isReadOnly()
+ * {@inheritDoc}
*/
public boolean isReadOnly()
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/GroupPermission.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/GroupPermission.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/GroupPermission.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/GroupPermission.java Sun Aug 3 05:17:34 2008
@@ -1,31 +1,32 @@
-/*
- JSPWiki - a JSP-based WikiWiki clone.
+/*
+ JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2006 JSPWiki Development Team
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
package com.ecyrd.jspwiki.auth.permissions;
+import java.io.Serializable;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.DomainCombiner;
import java.security.Permission;
import java.security.Principal;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.Set;
import javax.security.auth.Subject;
@@ -80,7 +81,7 @@
* @author Andrew Jaquith
* @since 2.4.17
*/
-public final class GroupPermission extends Permission
+public final class GroupPermission extends Permission implements Serializable
{
/** Special target token that denotes all groups that a Subject's Principals are members of. */
public static final String MEMBER_TOKEN = "<groupmember>";
@@ -125,6 +126,12 @@
private final String m_wiki;
+ /** For serialization purposes */
+ protected GroupPermission()
+ {
+ this("");
+ }
+
/**
* Private convenience constructor that creates a new GroupPermission for
* all wikis and groups (*:*) and set of actions.
@@ -349,9 +356,8 @@
}
int mask = 0;
String[] actionList = actions.split( ACTION_SEPARATOR );
- for( int i = 0; i < actionList.length; i++ )
+ for( String action : actionList )
{
- String action = actionList[i];
if ( action.equalsIgnoreCase( VIEW_ACTION ) )
{
mask |= VIEW_MASK;
@@ -481,10 +487,9 @@
// <member> implies permission if subject possesses
// GroupPrincipal with same name as target
Subject subject = ( (SubjectDomainCombiner) dc ).getSubject();
- Set principals = subject.getPrincipals( GroupPrincipal.class );
- for( Iterator it = principals.iterator(); it.hasNext(); )
+ Set<GroupPrincipal> principals = subject.getPrincipals( GroupPrincipal.class );
+ for( Principal principal : principals )
{
- Principal principal = (Principal) it.next();
if ( principal.getName().equals( gp.m_group ) )
{
return true;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PagePermission.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PagePermission.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PagePermission.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PagePermission.java Sun Aug 3 05:17:34 2008
@@ -1,24 +1,26 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 JSPWiki development group
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.permissions;
+import java.io.Serializable;
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.Arrays;
@@ -64,22 +66,29 @@
* @author Andrew Jaquith
* @since 2.3
*/
-public final class PagePermission extends Permission
+public final class PagePermission extends Permission implements Serializable
{
private static final long serialVersionUID = 2L;
+ /** Action name for the comment permission. */
public static final String COMMENT_ACTION = "comment";
+ /** Action name for the delete permission. */
public static final String DELETE_ACTION = "delete";
+ /** Action name for the edit permission. */
public static final String EDIT_ACTION = "edit";
+ /** Action name for the modify permission. */
public static final String MODIFY_ACTION = "modify";
+ /** Action name for the rename permission. */
public static final String RENAME_ACTION = "rename";
+ /** Action name for the upload permission. */
public static final String UPLOAD_ACTION = "upload";
+ /** Action name for the view permission. */
public static final String VIEW_ACTION = "view";
protected static final int COMMENT_MASK = 0x4;
@@ -96,18 +105,25 @@
protected static final int VIEW_MASK = 0x1;
+ /** A static instance of the comment permission. */
public static final PagePermission COMMENT = new PagePermission( COMMENT_ACTION );
+ /** A static instance of the delete permission. */
public static final PagePermission DELETE = new PagePermission( DELETE_ACTION );
+ /** A static instance of the edit permission. */
public static final PagePermission EDIT = new PagePermission( EDIT_ACTION );
+ /** A static instance of the rename permission. */
public static final PagePermission RENAME = new PagePermission( RENAME_ACTION );
+ /** A static instance of the modify permission. */
public static final PagePermission MODIFY = new PagePermission( MODIFY_ACTION );
+ /** A static instance of the upload permission. */
public static final PagePermission UPLOAD = new PagePermission( UPLOAD_ACTION );
+ /** A static instance of the view permission. */
public static final PagePermission VIEW = new PagePermission( VIEW_ACTION );
private static final String ACTION_SEPARATOR = ",";
@@ -126,6 +142,12 @@
private final String m_wiki;
+ /** For serialization purposes. */
+ protected PagePermission()
+ {
+ this("");
+ }
+
/**
* Private convenience constructor that creates a new PagePermission for all wikis and pages
* (*:*) and set of actions.
@@ -197,7 +219,8 @@
/**
* Two PagePermission objects are considered equal if their actions (after
* normalization), wiki and target are equal.
- * @see java.lang.Object#equals(java.lang.Object)
+ * @param obj {@inheritDoc}
+ * @return {@inheritDoc}
*/
public final boolean equals( Object obj )
{
@@ -214,7 +237,8 @@
* Returns the actions for this permission: "view", "edit", "comment",
* "modify", "upload" or "delete". The actions will always be sorted in alphabetic
* order, and will always appear in lower case.
- * @see java.security.Permission#getActions()
+ *
+ * @return {@inheritDoc}
*/
public final String getActions()
{
@@ -242,7 +266,7 @@
/**
* Returns the hash code for this PagePermission.
- * @see java.lang.Object#hashCode()
+ * @return {@inheritDoc}
*/
public final int hashCode()
{
@@ -272,6 +296,9 @@
* those of this permission</li>
* </ol>
* @see java.security.Permission#implies(java.security.Permission)
+ *
+ * @param permission {@inheritDoc}
+ * @return {@inheritDoc}
*/
public final boolean implies( Permission permission )
{
@@ -304,7 +331,9 @@
/**
* Returns a new {@link AllPermissionCollection}.
* @see java.security.Permission#newPermissionCollection()
+ * @return {@inheritDoc}
*/
+ @Override
public PermissionCollection newPermissionCollection()
{
return new AllPermissionCollection();
@@ -313,6 +342,8 @@
/**
* Prints a human-readable representation of this permission.
* @see java.lang.Object#toString()
+ *
+ * @return Something human-readable
*/
public final String toString()
{
@@ -413,9 +444,8 @@
}
int mask = 0;
String[] actionList = StringUtils.split( actions, ACTION_SEPARATOR );
- for( int i = 0; i < actionList.length; i++ )
+ for( String action : actionList )
{
- String action = actionList[i];
if ( action.equalsIgnoreCase( VIEW_ACTION ) )
{
mask |= VIEW_MASK;
@@ -451,4 +481,4 @@
}
return mask;
}
-}
\ No newline at end of file
+}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PermissionFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PermissionFactory.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PermissionFactory.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/PermissionFactory.java Sun Aug 3 05:17:34 2008
@@ -1,27 +1,25 @@
/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 JSPWiki development group
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.permissions;
-import java.security.Permission;
-import java.util.HashMap;
-import java.util.Map;
import java.util.WeakHashMap;
import com.ecyrd.jspwiki.WikiPage;
@@ -31,41 +29,20 @@
* and creating them takes a bit of time, caching them makes sense.
* <p>
* This class stores the permissions in a static HashMap.
- * @author Janne Jalkanen
* @since 2.5.54
*/
-public class PermissionFactory
+public final class PermissionFactory
{
/**
- * This is a WeakHashMap<Integer,PagePermission>, which stores the
- * cached page permissions.
+ * Prevent instantiation.
*/
- private static Map<Class<? extends Permission>,Map<Integer,Permission>> c_cache
- = new HashMap<Class<? extends Permission>,Map<Integer,Permission>>();
+ private PermissionFactory() {}
/**
- * Get a permission object for a Group and a set of actions.
- *
- * @param group the fully-qualified name of the group
- * @param actions A list of actions.
- * @return A GroupPermission object, presenting this group+actions combination.
+ * This is a WeakHashMap<Integer,PagePermission>, which stores the
+ * cached page permissions.
*/
- public static final GroupPermission getGroupPermission( String group, String actions )
- {
- Map<Integer,Permission> cachedPerms = getPermissionCache( GroupPermission.class );
- Integer key = new Integer( group.hashCode() ^ actions.hashCode() );
- GroupPermission perm;
- synchronized( cachedPerms )
- {
- perm = (GroupPermission)cachedPerms.get( key );
- if( perm == null )
- {
- perm = new GroupPermission( group, actions );
- cachedPerms.put( key, perm );
- }
- }
- return perm;
- }
+ private static WeakHashMap<Integer, PagePermission> c_cache = new WeakHashMap<Integer, PagePermission>();
/**
* Get a permission object for a WikiPage and a set of actions.
@@ -76,43 +53,19 @@
*/
public static final PagePermission getPagePermission( WikiPage page, String actions )
{
- Map<Integer,Permission> cachedPerms = getPermissionCache( GroupPermission.class );
- Integer key = new Integer( page.getWiki().hashCode() ^ page.getName().hashCode() ^ actions.hashCode() );
- PagePermission perm;
- synchronized( cachedPerms )
- {
- perm = (PagePermission)cachedPerms.get( key );
- if( perm == null )
- {
- perm = new PagePermission( page, actions );
- cachedPerms.put( key, perm );
- }
- }
- return perm;
+ return getPagePermission( page.getWiki(), page.getName(), actions );
}
/**
* Get a permission object for a WikiPage and a set of actions.
*
- * @param page The name of the page, including the wiki prefix (e.g., MyWiki:Main)
+ * @param page The name of the page.
* @param actions A list of actions.
* @return A PagePermission object, presenting this page+actions combination.
*/
public static final PagePermission getPagePermission( String page, String actions )
{
- Map<Integer,Permission> cachedPerms = getPermissionCache( GroupPermission.class );
- Integer key = new Integer( page.hashCode() ^ actions.hashCode() );
- PagePermission perm;
- synchronized( cachedPerms )
- {
- perm = (PagePermission)cachedPerms.get( key );
- if( perm == null )
- {
- perm = new PagePermission( page, actions );
- cachedPerms.put( key, perm );
- }
- }
- return perm;
+ return getPagePermission( "", page, actions );
}
/**
@@ -123,36 +76,41 @@
* @param actions A list of actions.
* @return A PagePermission object.
*/
- public static final WikiPermission getWikiPermission( String wiki, String actions )
+ private static final PagePermission getPagePermission( String wiki, String page, String actions )
{
- Map<Integer,Permission> cachedPerms = getPermissionCache( GroupPermission.class );
- Integer key = new Integer( wiki.hashCode() ^ actions.hashCode() );
- WikiPermission perm;
- synchronized( cachedPerms )
+ PagePermission perm;
+ //
+ // Since this is pretty speed-critical, we try to avoid the StringBuffer creation
+ // overhead by XORring the hashcodes. However, if page name length > 32 characters,
+ // this might result in two same hashCodes.
+ // FIXME: Make this work for page-name lengths > 32 characters (use the alt implementation
+ // if page.length() > 32?)
+ // Alternative implementation below, but it does create an extra StringBuffer.
+ //String key = wiki+":"+page+":"+actions;
+
+ Integer key = wiki.hashCode() ^ page.hashCode() ^ actions.hashCode();
+
+ //
+ // It's fine if two threads update the cache, since the objects mean the same
+ // thing anyway. And this avoids nasty blocking effects.
+ //
+ synchronized( c_cache )
{
- perm = (WikiPermission)cachedPerms.get( key );
- if( perm == null )
- {
- perm = new WikiPermission( wiki, actions );
- cachedPerms.put( key, perm );
- }
+ perm = c_cache.get( key );
}
- return perm;
- }
-
- private static Map<Integer,Permission>getPermissionCache( Class<? extends Permission> permClass )
- {
- // Get the HashMap for our permission type (creating it if needed)
- Map<Integer,Permission> cachedPerms = c_cache.get(permClass);
- if ( cachedPerms == null )
+
+ if( perm == null )
{
- synchronized ( c_cache )
+ if( wiki.length() > 0 ) page = wiki+":"+page;
+ perm = new PagePermission( page, actions );
+
+ synchronized( c_cache )
{
- cachedPerms = new WeakHashMap<Integer,Permission>();
- c_cache.put(permClass,cachedPerms);
+ c_cache.put( key, perm );
}
}
- return cachedPerms;
+
+ return perm;
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/WikiPermission.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/WikiPermission.java?rev=682144&r1=682143&r2=682144&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/WikiPermission.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/auth/permissions/WikiPermission.java Sun Aug 3 05:17:34 2008
@@ -1,24 +1,26 @@
-/*
+/*
JSPWiki - a JSP-based WikiWiki clone.
- Copyright (C) 2001-2007 JSPWiki development group
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
*/
package com.ecyrd.jspwiki.auth.permissions;
+import java.io.Serializable;
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.Arrays;
@@ -36,20 +38,26 @@
* @author Andrew Jaquith
* @since 2.3
*/
-public final class WikiPermission extends Permission
+public final class WikiPermission extends Permission implements Serializable
{
private static final long serialVersionUID = 1L;
+ /** Name of the action for createGroups permission. */
public static final String CREATE_GROUPS_ACTION = "createGroups";
+ /** Name of the action for createPages permission. */
public static final String CREATE_PAGES_ACTION = "createPages";
+ /** Name of the action for login permission. */
public static final String LOGIN_ACTION = "login";
+ /** Name of the action for editPreferences permission. */
public static final String EDIT_PREFERENCES_ACTION = "editPreferences";
+ /** Name of the action for editProfile permission. */
public static final String EDIT_PROFILE_ACTION = "editProfile";
+ /** Value for a generic wildcard. */
public static final String WILDCARD = "*";
protected static final int CREATE_GROUPS_MASK = 0x1;
@@ -62,14 +70,19 @@
protected static final int LOGIN_MASK = 0x10;
+ /** A static instance of the createGroups permission. */
public static final WikiPermission CREATE_GROUPS = new WikiPermission( WILDCARD, CREATE_GROUPS_ACTION );
+ /** A static instance of the createPages permission. */
public static final WikiPermission CREATE_PAGES = new WikiPermission( WILDCARD, CREATE_PAGES_ACTION );
+ /** A static instance of the login permission. */
public static final WikiPermission LOGIN = new WikiPermission( WILDCARD, LOGIN_ACTION );
+ /** A static instance of the editPreferences permission. */
public static final WikiPermission EDIT_PREFERENCES = new WikiPermission( WILDCARD, EDIT_PREFERENCES_ACTION );
+ /** A static instance of the editProfile permission. */
public static final WikiPermission EDIT_PROFILE = new WikiPermission( WILDCARD, EDIT_PROFILE_ACTION );
private final String m_actionString;
@@ -81,6 +94,7 @@
/**
* Creates a new WikiPermission for a specified set of actions.
* @param actions the actions for this permission
+ * @param wiki The name of the wiki the permission belongs to.
*/
public WikiPermission( String wiki, String actions )
{
@@ -143,7 +157,7 @@
/**
* Returns the hash code for this WikiPermission.
- * @see java.lang.Object#hashCode()
+ * @return {@inheritDoc}
*/
public final int hashCode()
{
@@ -182,7 +196,7 @@
/**
* Returns a new {@link AllPermissionCollection}.
- * @see java.security.Permission#newPermissionCollection()
+ * @return {@inheritDoc}
*/
public PermissionCollection newPermissionCollection()
{
@@ -191,7 +205,7 @@
/**
* Prints a human-readable representation of this permission.
- * @see java.lang.Object#toString()
+ * @return {@inheritDoc}
*/
public final String toString()
{
@@ -257,4 +271,4 @@
}
return mask;
}
-}
\ No newline at end of file
+}