* Licensed 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
* Licensed 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
* 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.
* 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.
private static final String GET_PERMS_BY_USER = "Get Perms by User";
private static final String USER_HAS_PERM ="User Has Perm";
// private static final String USER_IN_ROLE ="User Has Role";
private static final String GET_PERMS_BY_USER = "Get Perms by User";
private static final String USER_HAS_PERM ="User Has Perm";
// private static final String USER_IN_ROLE ="User Has Role";
gwAPI.route(HttpMethods.GET,"/authz/perms/user/:user",API.VOID,new LocateCode(facade,GET_PERMS_BY_USER, true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
gwAPI.route(HttpMethods.GET,"/authz/perms/user/:user",API.VOID,new LocateCode(facade,GET_PERMS_BY_USER, true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
try {
final String accept = req.getHeader("ACCEPT");
final String user = pathParam(req,":user");
try {
final String accept = req.getHeader("ACCEPT");
final String user = pathParam(req,":user");
context.error(trans,resp,Result.ERR_BadData,"User [%s] must be fully qualified with domain",user);
return;
}
context.error(trans,resp,Result.ERR_BadData,"User [%s] must be fully qualified with domain",user);
return;
}
tt2 = trans.start("AAF Service Call",Env.REMOTE);
try {
gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<String> fp = client.read("/authz/perms/user/"+user,accept);
tt2 = trans.start("AAF Service Call",Env.REMOTE);
try {
gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
@Override
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<String> fp = client.read("/authz/perms/user/"+user,accept);
gwAPI.cacheUser.put(key, new Dated(new User(fp.code(),fp.body()),gwAPI.expireIn));
resp.setStatus(HttpStatus.OK_200);
ServletOutputStream sos;
gwAPI.cacheUser.put(key, new Dated(new User(fp.code(),fp.body()),gwAPI.expireIn));
resp.setStatus(HttpStatus.OK_200);
ServletOutputStream sos;
pathParam(req,":instance"),
pathParam(req,":action"))));
resp.setStatus(HttpStatus.OK_200);
pathParam(req,":instance"),
pathParam(req,":action"))));
resp.setStatus(HttpStatus.OK_200);
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/"+pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
"gui/"+pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
+ redirect(trans, req, resp, context,
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/home");
} catch (Exception e) {
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
});
"gui/home");
} catch (Exception e) {
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
});
*/
gwAPI.route(HttpMethods.GET,"/configure/:id/:type",API.CONFIG,new LocateCode(facade,"Deliver Configuration Properties to AAF", true) {
@Override
*/
gwAPI.route(HttpMethods.GET,"/configure/:id/:type",API.CONFIG,new LocateCode(facade,"Deliver Configuration Properties to AAF", true) {
@Override
private static void redirect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, LocateFacade context, Locator<URI> loc, String path) throws IOException {
try {
private static void redirect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, LocateFacade context, Locator<URI> loc, String path) throws IOException {
try {
resp.sendRedirect(redirectURL.toString());
} else {
context.error(trans, resp, Result.err(Result.ERR_NotFound,"No Locations found for redirection"));
resp.sendRedirect(redirectURL.toString());
} else {
context.error(trans, resp, Result.err(Result.ERR_NotFound,"No Locations found for redirection"));