]> git.argeo.org Git - lgpl/argeo-commons.git/blob - JackrabbitAuthorizations.java
84e07992f4bf2b65edfad354f33e38493efc915d
[lgpl/argeo-commons.git] / JackrabbitAuthorizations.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.jackrabbit;
17
18 import java.security.Principal;
19 import java.util.List;
20
21 import javax.jcr.RepositoryException;
22 import javax.jcr.Session;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.argeo.jcr.security.JcrAuthorizations;
27
28 /** Apply authorizations to a Jackrabbit repository. */
29 @Deprecated
30 public class JackrabbitAuthorizations extends JcrAuthorizations {
31 private final static Log log = LogFactory.getLog(JackrabbitAuthorizations.class);
32
33 // private List<String> groupPrefixes = Arrays.asList(new String[] { "ROLE_"
34 // });// new
35 // ArrayList<String>();
36
37 @Override
38 protected Principal getOrCreatePrincipal(Session session, String principalName) throws RepositoryException {
39 String msg = "Use org.argeo.jcr.security.JcrAuthorizations instead of org.argeo.jackrabbit.JackrabbitAuthorizations";
40 log.error(msg);
41 throw new UnsupportedOperationException(msg);
42 // UserManager um = ((JackrabbitSession) session).getUserManager();
43 // synchronized (um) {
44 // Authorizable authorizable = um.getAuthorizable(principalName);
45 // if (authorizable == null) {
46 // groupPrefixes: for (String groupPrefix : groupPrefixes) {
47 // if (principalName.startsWith(groupPrefix)) {
48 // authorizable = um.createGroup(principalName);
49 // log.info("Created group " + principalName);
50 // break groupPrefixes;
51 // }
52 // }
53 // if (authorizable == null)
54 // throw new ArgeoException("Authorizable " + principalName
55 // + " not found");
56 // }
57 // return authorizable.getPrincipal();
58 // }
59 }
60
61 public void setGroupPrefixes(List<String> groupsToCreate) {
62 // this.groupPrefixes = groupsToCreate;
63 }
64 }