X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-gui%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fgui%2FAAF_GUI.java;h=5d243e9b7381b71c82f90d0a811e9eb420046353;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=064a8a5c91d5c1530c54328804bedcfda477fc97;hpb=d087d3ddd2829ced1d2ffccc5147c377cbcc92cb;p=aaf%2Fauthz.git diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java index 064a8a5c..5d243e9b 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java @@ -7,9 +7,9 @@ * 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 - * + * * 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. @@ -26,6 +26,9 @@ import static org.onap.aaf.auth.rserv.HttpMethods.POST; import static org.onap.aaf.auth.rserv.HttpMethods.PUT; import javax.servlet.Filter; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import org.onap.aaf.auth.cmd.Cmd; import org.onap.aaf.auth.cui.CUI; @@ -40,6 +43,7 @@ import org.onap.aaf.auth.gui.pages.CMArtiChangeAction; import org.onap.aaf.auth.gui.pages.CMArtiChangeForm; import org.onap.aaf.auth.gui.pages.CMArtifactShow; import org.onap.aaf.auth.gui.pages.CredDetail; +import org.onap.aaf.auth.gui.pages.CredHistory; import org.onap.aaf.auth.gui.pages.Home; import org.onap.aaf.auth.gui.pages.LoginLanding; import org.onap.aaf.auth.gui.pages.LoginLandingAction; @@ -66,6 +70,7 @@ import org.onap.aaf.auth.gui.pages.UserRoleExtend; import org.onap.aaf.auth.gui.pages.UserRoleRemove; import org.onap.aaf.auth.gui.pages.WebCommand; import org.onap.aaf.auth.rserv.CachingFileAccess; +import org.onap.aaf.auth.rserv.HttpCode; import org.onap.aaf.auth.server.AbsService; import org.onap.aaf.auth.server.JettyServiceStarter; import org.onap.aaf.auth.server.Log4JLogIt; @@ -94,14 +99,14 @@ import certman.v1_0.Artifacts; import certman.v1_0.CertInfo; public class AAF_GUI extends AbsService implements State{ - private static final String AAF_GUI_THEME = "aaf_gui_theme"; + public static final String AAF_GUI_THEME = "aaf_gui_theme"; public static final String AAF_GUI_COPYRIGHT = "aaf_gui_copyright"; public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST"; public static final int TIMEOUT = 60000; public static final String app = "AAF GUI"; - + // AAF API - + // Certificate manager API public RosettaDF artifactsDF; public RosettaDF certInfoDF; @@ -109,29 +114,33 @@ public class AAF_GUI extends AbsService implements State implements State(null, "Clear"){ + @Override + public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { + trans.clearCache(); + Cookie cookies[] = req.getCookies(); + if(cookies!=null) { + for(Cookie c : cookies) { + if(c.getName().startsWith("aaf.gui.")) { + c.setMaxAge(0); + resp.addCookie(c); + } + } + } + resp.sendRedirect("/gui/home"); + } + }, "text/plain;charset=utf-8","*/*"); + + /////////////////////// // WebContent Handler /////////////////////// - route(env,GET,"/"+env.get(sThemeWebPath)+"/:key", new CachingFileAccess(env)); + CachingFileAccess cfa = new CachingFileAccess(env); + //route(env,GET,"/"+env.get(sThemeWebPath)+"/:key*", cfa); + route(env,GET,"/theme/:key*", cfa); /////////////////////// aafCon = aafCon(); lur = aafCon.newLur(); } - + public RosettaDF getDF(Class cls) throws APIException { return Cmd.getDF(env,cls); } - + public void writeError(AuthzTrans trans, Future fp, HTMLGen hgen, int indent) { if (hgen!=null) { String msg = aafCon.readableErrMsg(fp); @@ -227,7 +256,7 @@ public class AAF_GUI extends AbsService implements State RET cmClientAsUser(TaggedPrincipal p,Retryable retryable) throws APIException, LocatorException, CadiException { return cmCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable); } - + @Override public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException { try { @@ -256,9 +285,13 @@ public class AAF_GUI extends AbsService implements State jss = new JettyServiceStarter(service); - jss.start(); + try { + new JettyServiceStarter( + new AAF_GUI(new AuthzEnv(propAccess)),true) + .start(); + } catch (Exception e) { + propAccess.log(e); + } } catch (Exception e) { e.printStackTrace(); }