This project has retired. For details please refer to its Attic page.
AuthorizationDataSource xref
View Javadoc

1   package org.apache.archiva.redback.authorization;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.redback.users.User;
23  
24  /**
25   * @author Jason van Zyl
26   */
27  public class AuthorizationDataSource
28  {
29      private String principal;
30  
31      private User user;
32  
33      private String permission;
34  
35      private String resource;
36  
37      public AuthorizationDataSource( String principal, User user, String permission )
38      {
39          this.principal = principal;
40          this.user = user;
41          this.permission = permission;
42      }
43  
44      public AuthorizationDataSource( String principal, User user, String permission, String resource )
45      {
46          this.principal = principal;
47          this.user = user;
48          this.permission = permission;
49          this.resource = resource;
50      }
51  
52      public String getPrincipal()
53      {
54          return principal;
55      }
56  
57      public void setPrincipal( String principal )
58      {
59          this.principal = principal;
60      }
61  
62      public User getUser()
63      {
64          return user;
65      }
66  
67      public void setUser( User user )
68      {
69          this.user = user;
70      }
71  
72      public String getPermission()
73      {
74          return permission;
75      }
76  
77      public void setPermission( String permission )
78      {
79          this.permission = permission;
80      }
81  
82      public String getResource()
83      {
84          return resource;
85      }
86  
87      public void setResource( String resource )
88      {
89          this.resource = resource;
90      }
91  
92      @Override
93      public String toString()
94      {
95          final StringBuilder sb = new StringBuilder();
96          sb.append( "AuthorizationDataSource" );
97          sb.append( "{principal='" ).append( principal ).append( '\'' );
98          // not display password in logs
99          //sb.append( ", user=" ).append( user );
100         sb.append( ", permission='" ).append( permission ).append( '\'' );
101         sb.append( ", resource='" ).append( resource ).append( '\'' );
102         sb.append( '}' );
103         return sb.toString();
104     }
105 }