1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * Copyright © 2017 Amdocs
\r
7 * * ===========================================================================
\r
8 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * * you may not use this file except in compliance with the License.
\r
10 * * You may obtain a copy of the License at
\r
12 * * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * * Unless required by applicable law or agreed to in writing, software
\r
15 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * * See the License for the specific language governing permissions and
\r
18 * * limitations under the License.
\r
19 * * ============LICENSE_END====================================================
\r
21 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 ******************************************************************************/
\r
24 package com.att.authz.facade;
\r
26 import java.util.Date;
\r
28 import javax.servlet.http.HttpServletRequest;
\r
29 import javax.servlet.http.HttpServletResponse;
\r
31 import com.att.authz.env.AuthzTrans;
\r
32 import com.att.authz.layer.Result;
\r
33 import com.att.cssa.rserv.RServlet;
\r
34 import com.att.dao.aaf.cass.NsType;
\r
38 * This layer is responsible for covering the Incoming Messages, be they XML, JSON or just entries on the URL,
\r
39 * and converting them to data that can be called on the Service Layer.
\r
41 * Upon response, this layer, because it knew the incoming Data Formats (i.e. XML/JSON), the HTTP call types
\r
42 * are set on "ContentType" on Response.
\r
44 * Finally, we wrap the call in Time Stamps with explanation of what is happing for Audit trails.
\r
48 public interface AuthzFacade {
\r
49 public static final int PERM_DEPEND_424 = -1000;
\r
50 public static final int ROLE_DEPEND_424 = -1001;
\r
55 public abstract Result<Void> requestNS(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, NsType type);
\r
57 public abstract Result<Void> getNSsByName(AuthzTrans trans, HttpServletResponse resp, String ns);
\r
59 public abstract Result<Void> getNSsByAdmin(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
\r
61 public abstract Result<Void> getNSsByResponsible(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
\r
63 public abstract Result<Void> getNSsByEither(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
\r
65 public abstract Result<Void> getNSsChildren(AuthzTrans trans, HttpServletResponse resp, String pathParam);
\r
67 public abstract Result<Void> addAdminToNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
\r
69 public abstract Result<Void> delAdminFromNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
\r
71 public abstract Result<Void> addResponsibilityForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
\r
73 public abstract Result<Void> delResponsibilityForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
\r
75 public abstract Result<Void> updateNsDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
77 public abstract Result<Void> deleteNS(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, String ns);
\r
80 public abstract Result<Void> createAttribForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String key, String value);
\r
82 public abstract Result<Void> readNsByAttrib(AuthzTrans trans, HttpServletResponse resp, String key);
\r
84 public abstract Result<Void> updAttribForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String key, String value);
\r
86 public abstract Result<Void> delAttribForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String key);
\r
91 public abstract Result<Void> createPerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
93 public abstract Result<Void> getPermsByName(AuthzTrans trans, HttpServletResponse resp,
\r
94 String type, String instance, String action);
\r
96 public abstract Result<Void> getPermsByUser(AuthzTrans trans, HttpServletResponse response, String user);
\r
98 public abstract Result<Void> getPermsByUserWithAAFQuery(AuthzTrans trans, HttpServletRequest request, HttpServletResponse response, String user);
\r
100 public abstract Result<Void> getPermsByType(AuthzTrans trans, HttpServletResponse resp, String type);
\r
102 public abstract Result<Void> getPermsForRole(AuthzTrans trans, HttpServletResponse response, String roleName);
\r
104 public abstract Result<Void> getPermsByNS(AuthzTrans trans, HttpServletResponse response, String ns);
\r
106 public abstract Result<Void> renamePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp,
\r
107 String type, String instance, String action);
\r
109 public abstract Result<Void> updatePermDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
111 public abstract Result<Void> resetPermRoles(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
113 public abstract Result<Void> deletePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
115 public abstract Result<Void> deletePerm(AuthzTrans trans, HttpServletResponse resp,
\r
116 String perm, String type, String action);
\r
121 public abstract Result<Void> createRole(AuthzTrans trans, HttpServletRequest req, HttpServletResponse response);
\r
123 public abstract Result<Void> getRolesByName(AuthzTrans trans,HttpServletResponse resp, String name);
\r
125 public abstract Result<Void> getRolesByNS(AuthzTrans trans, HttpServletResponse resp, String ns);
\r
127 public abstract Result<Void> getRolesByNameOnly(AuthzTrans trans, HttpServletResponse resp, String nameOnly);
\r
129 public abstract Result<Void> getRolesByUser(AuthzTrans trans, HttpServletResponse resp, String user);
\r
131 public abstract Result<Void> getRolesByPerm(AuthzTrans trans, HttpServletResponse resp, String type, String instance, String action);
\r
133 public abstract Result<Void> updateRoleDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
135 public abstract Result<Void> addPermToRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
\r
137 public abstract Result<Void> delPermFromRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
\r
139 public abstract Result<Void> deleteRole(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
141 public abstract Result<Void> deleteRole(AuthzTrans trans, HttpServletResponse resp, String role);
\r
147 public abstract Result<Void> getUsersByRole(AuthzTrans trans, HttpServletResponse resp, String role);
\r
149 public abstract Result<Void> getUsersByPermission(AuthzTrans trans, HttpServletResponse resp,
\r
150 String type, String instance, String action);
\r
157 public abstract Result<Void> createDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
159 public abstract Result<Void> updateDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
161 public abstract Result<Void> deleteDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
163 public abstract Result<Void> deleteDelegate(AuthzTrans trans, String user);
\r
165 public abstract Result<Void> getDelegatesByUser(AuthzTrans trans, String userName, HttpServletResponse resp);
\r
167 public abstract Result<Void> getDelegatesByDelegate(AuthzTrans trans, String userName, HttpServletResponse resp);
\r
172 public abstract Result<Void> createUserCred(AuthzTrans trans, HttpServletRequest req);
\r
174 public abstract Result<Void> changeUserCred(AuthzTrans trans, HttpServletRequest req);
\r
176 public abstract Result<Void> extendUserCred(AuthzTrans trans, HttpServletRequest req, String days);
\r
178 public abstract Result<Void> getCredsByNS(AuthzTrans trans, HttpServletResponse resp, String ns);
\r
180 public abstract Result<Void> getCredsByID(AuthzTrans trans, HttpServletResponse resp, String id);
\r
182 public abstract Result<Void> deleteUserCred(AuthzTrans trans, HttpServletRequest req);
\r
184 public abstract Result<Void> validBasicAuth(AuthzTrans trans, HttpServletResponse resp, String basicAuth);
\r
186 public abstract Result<Date> doesCredentialMatch(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
192 * Place Standard Messages based on HTTP Code onto Error Data Structure, and write to OutputStream
\r
195 public abstract void error(AuthzTrans trans, HttpServletResponse response, Result<?> result);
\r
200 public abstract Result<Void> requestUserRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
\r
202 public abstract Result<Void> getUserInRole(AuthzTrans trans, HttpServletResponse resp, String user, String role);
\r
204 public abstract Result<Void> getUserRolesByRole(AuthzTrans trans, HttpServletResponse resp, String role);
\r
206 public abstract Result<Void> getUserRolesByUser(AuthzTrans trans, HttpServletResponse resp, String user);
\r
208 public abstract Result<Void> deleteUserRole(AuthzTrans trans, HttpServletResponse resp, String user, String role);
\r
210 public abstract Result<Void> resetUsersForRole(AuthzTrans trans, HttpServletResponse resp, HttpServletRequest req);
\r
212 public abstract Result<Void> resetRolesForUser(AuthzTrans trans, HttpServletResponse resp, HttpServletRequest req);
\r
214 public abstract Result<Void> extendUserRoleExpiration(AuthzTrans trans, HttpServletResponse resp, String user,
\r
220 public abstract Result<Void> updateApproval(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
\r
222 public abstract Result<Void> getApprovalsByUser(AuthzTrans trans, HttpServletResponse resp, String user);
\r
224 public abstract Result<Void> getApprovalsByTicket(AuthzTrans trans, HttpServletResponse resp, String ticket);
\r
226 public abstract Result<Void> getApprovalsByApprover(AuthzTrans trans, HttpServletResponse resp, String approver);
\r
232 public abstract Result<Void> getHistoryByUser(AuthzTrans trans, HttpServletResponse resp, String user, int[] yyyymm, final int sort);
\r
234 public abstract Result<Void> getHistoryByRole(AuthzTrans trans, HttpServletResponse resp, String subject, int[] yyyymm, final int sort);
\r
236 public abstract Result<Void> getHistoryByPerm(AuthzTrans trans, HttpServletResponse resp, String subject, int[] yyyymm, final int sort);
\r
238 public abstract Result<Void> getHistoryByNS(AuthzTrans trans, HttpServletResponse resp, String subject, int[] yyyymm, final int sort);
\r
243 public abstract Result<Void> cacheClear(AuthzTrans trans, String pathParam);
\r
245 public abstract Result<Void> cacheClear(AuthzTrans trans, String string,String segments);
\r
247 public abstract void dbReset(AuthzTrans trans);
\r
254 public Result<Void> getAPI(AuthzTrans trans, HttpServletResponse resp, RServlet<AuthzTrans> rservlet);
\r
256 public abstract Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String typeCode, boolean optional);
\r
258 public abstract Result<Void> getCertInfoByID(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, String id);
\r