I am trying to show username and images on Springboard after login. Currently, I can retrieve username from web server without checking user authentication once service started.
I am new to MAF. After login into IDCS with Web service, How to check HTTP Basic user authentication in java? please guide me.
<?xml version="1.0" encoding="UTF-8" ?>
<amx:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"
xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt" xmlns:adfmf="http://xmlns.oracle.com/adf/mf">
<amx:panelPage id="pp1">
<amx:facet name="header">
<amx:tableLayout id="tl1" halign="center">
<amx:rowLayout id="rl1">
<amx:cellFormat id="cf5" >
<amx:outputText value="Care Apps" id="ot1" styleClass="titleText"/>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout>
</amx:facet>
<amx:facet name="primary">
<amx:tableLayout id="tl2" halign="center">
<amx:rowLayout id="rl2">
<amx:cellFormat id="cf4" >
<amx:image id="i3" source="/images/CARE_logo_60.png"/>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout>
</amx:facet>
<amx:tableLayout id="tl4" styleClass="menuUserLayout">
<amx:rowLayout id="rl6" >
<amx:cellFormat id="cf6" rowSpan="3" halign="center" inlineStyle="width:100%;" >
<adfmf:constraints>
<adfmf:constraintExpression value="#{securityContext.authenticated==true}" id="c1"/>
</adfmf:constraints>
<amx:image id="i4" source="/images/user_logo.png" styleClass="menuUserImage" />
</amx:cellFormat>
</amx:rowLayout>
<amx:rowLayout id="rl5">
<amx:cellFormat id="cf3" rowSpan="3">
<amx:outputText value="#{Profile.userName}" id="ot4" styleClass="menuText"/>
</amx:cellFormat>
</amx:rowLayout>
</amx:tableLayout>
<amx:tableLayout id="tl3" styleClass="menuTabLayout">
<amx:iterator var="row" value="#{bindings.features.collectionModel}" id="i1" >
<amx:rowLayout id="rl3" >
<amx:cellFormat id="cf1">
<amx:commandLink actionListener="#{bindings.gotoFeature.execute}"
disabled="#{!bindings.gotoFeature.enabled}" id="cl1">
<amx:image id="i2" source="#{row.image}" inlineStyle="width:45px;height:45px;padding-left:10px;padding-top:3px;padding-bottom:3px;"/>
<amx:setPropertyListener id="spl1" from="#{row.id}" to="#{pageFlowScope.FeatureId}" type="action"/>
</amx:commandLink>
</amx:cellFormat>
<amx:cellFormat id="cf2">
<amx:outputText value="#{row.name}" id="ot2" styleClass="menuText"/>
</amx:cellFormat>
</amx:rowLayout>
</amx:iterator>
</amx:tableLayout>
</amx:panelPage>
</amx:view>
public String getUserName(){
try{
String responseData =
CareUtils.invokeRestService("IdcsLoginCon", "/custom/dev_api_app/my/profile" , "GET",
"application/json", "");
System.out.println("My REsponse DATA"+responseData);
JSONObject obj = new JSONObject(responseData);
this.userName= obj.getString("user_name");
}catch(Exception e){
System.out.println("Unable to retrieve data");
e.printStackTrace();
};
return userName;
}
I expect the output of username on springboard after login. After logout,username should be disappeared.Now, Username is still remained after logout.