You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2012/07/24 15:51:36 UTC

svn commit: r1365058 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal: AdminPrincipal.java AnonymousPrincipal.java

Author: angela
Date: Tue Jul 24 13:51:35 2012
New Revision: 1365058

URL: http://svn.apache.org/viewvc?rev=1365058&view=rev
Log:
OAK-90 : Implement Principal Management  (work in progress)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AdminPrincipal.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AnonymousPrincipal.java

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AdminPrincipal.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AdminPrincipal.java?rev=1365058&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AdminPrincipal.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AdminPrincipal.java Tue Jul 24 13:51:35 2012
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.jackrabbit.oak.spi.security.principal;
+
+import java.security.Principal;
+
+/**
+ * Principal used to mark an administrator. The aim of this principal
+ * is to simplify the check whether a given set of principals is supplied with
+ * special (admin) access permissions. It may be used as the single or as
+ * additional non-group principal.
+ */
+public final class AdminPrincipal implements Principal {
+
+    public static final String NAME = "administrator";
+
+    public static final AdminPrincipal INSTANCE = new AdminPrincipal();
+
+    private AdminPrincipal() { }
+
+    //----------------------------------------------------------< Principal >---
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    //-------------------------------------------------------------< Object >---
+    @Override
+    public String toString() {
+        return NAME + " principal";
+    }
+}

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AnonymousPrincipal.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AnonymousPrincipal.java?rev=1365058&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AnonymousPrincipal.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/principal/AnonymousPrincipal.java Tue Jul 24 13:51:35 2012
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.jackrabbit.oak.spi.security.principal;
+
+import java.security.Principal;
+
+/**
+ * Principal used to mark a principal that results from a login using
+ * {@link javax.jcr.GuestCredentials} or any other credentials that result in
+ * "anonymous" login. Whether or not this principal is used as single or as
+ * additional non-group principal is left to the implementation.
+ */
+public final class AnonymousPrincipal implements Principal {
+
+    public static final String NAME = "anonymous";
+
+    public static final AnonymousPrincipal INSTANCE = new AnonymousPrincipal();
+
+    private AnonymousPrincipal() { }
+
+    //----------------------------------------------------------< Principal >---
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    //-------------------------------------------------------------< Object >---
+    @Override
+    public String toString() {
+        return NAME + " principal";
+    }
+}