AT&T 2.0.19 Code drop, stage 3
[aaf/authz.git] / auth / auth-gui / src / main / java / org / onap / aaf / auth / gui / pages / LoginLandingAction.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6  * ===========================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21
22 package org.onap.aaf.auth.gui.pages;
23
24 import java.io.IOException;
25
26 import org.onap.aaf.auth.env.AuthzTrans;
27 import org.onap.aaf.auth.gui.AAF_GUI;
28 import org.onap.aaf.auth.gui.BreadCrumbs;
29 import org.onap.aaf.auth.gui.NamedCode;
30 import org.onap.aaf.auth.gui.Page;
31 import org.onap.aaf.misc.env.APIException;
32 import org.onap.aaf.misc.env.Slot;
33 import org.onap.aaf.misc.xgen.Cache;
34 import org.onap.aaf.misc.xgen.DynamicCode;
35 import org.onap.aaf.misc.xgen.html.HTMLGen;
36
37 public class LoginLandingAction extends Page {
38         public LoginLandingAction(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
39                 super(gui.env,"Login",LoginLanding.HREF, LoginLanding.fields,
40                         new BreadCrumbs(breadcrumbs),
41                         new NamedCode(true,"content") {
42                                 final Slot sID = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[0]);
43 //                              final Slot sPassword = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[1]);
44                                 
45                                 @Override
46                                 public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
47                                         cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
48                                                 @Override
49                                                 public void code(final AAF_GUI gui, final AuthzTrans trans,final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
50                                                         String username = trans.get(sID,null);
51 //                                                      String password = trans.get(sPassword,null);
52
53                                                         hgen.p("User: "+username);
54                                                         hgen.p("Pass: ********");
55                                                         
56                                                         // TODO: clarification from JG
57                                                         // put in request header?
58                                                         // then pass through authn/basicAuth call?
59                                                         
60                                                 }
61                                         });
62                                 }
63                 });
64         }
65 }