11 Replies Latest reply: Nov 24, 2012 8:56 AM by ArunBabu RSS

    ADF Mobile Authentication

    larry.phillips
      Following the description in chapter 17 of the Oracle Fusion Middleware Mobile Developer's Guide for Oracle ADF I was able to create a simple mobile app with a feature that requires remote authentication, using the ADF Mobile default login page and it works fine. My question is, from within the mobile app how would I go about finding out the username of the user who successfully logged in?

      Using JDev 11.1.2.3.0.
        • 1. Re: ADF Mobile Authentication
          ArunBabu
          Hi,
          You can get the logged in user with #{securityContext.userName}
          Tested with latest drop17.

          Arun
          • 2. Re: ADF Mobile Authentication
            Naveen2
            Hi,
            On which device/emulator was this tested up on ? I am trying to test the "default" login feature and have followed all the steps mentioned in the developers guide chapter 17. Deploying on to "Android Emulator", the login page is not displayed and the app goes to the first page by default without asking for user credentials. Kindly let me know what step am i missing ?

            Regards
            Naveen
            • 3. Re: ADF Mobile Authentication
              ArunBabu
              I havent tested it in android.
              With a working ADF Mobile Login Connection, security enabled for that particular feature in adfm-feature.xml and Application Login Server set to login Connection in admf-application.xml for that particular feature,
              it should be working!
              Please recheck if you have missed any steps.

              Arun
              • 4. Re: ADF Mobile Authentication
                Naveen2
                Hi,
                Thanks for the input. Yes, i have followed all the steps as per the guide - Enabled Security at the Feature Level in adfmf-feature.xml. In adfmf-application.xml have created the login server connection and tested and set the Login page to Default. But when deployed to android emulator, the default login page fails to display and directly goes to the feature page.

                Regards
                Naveen
                • 5. Re: ADF Mobile Authentication
                  ArunBabu
                  I just tested in Android also.It works.
                  Maybe just share your admf-feature.xml,connections.xml and adfmf-application.xml
                  I can give a look but not very sure if it can be solved!


                  Arun
                  • 6. Re: ADF Mobile Authentication
                    Naveen2
                    Hi,

                    adfmf-feature.xml

                    <?xml version="1.0" encoding="UTF-8" ?>
                    <adfmf:features xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adfmf="http://xmlns.oracle.com/adf/mf">
                    <adfmf:feature id="oracle.dept" name="Dept" credentials="remote">
                    <adfmf:content id="oracle.dept.1">
                    <adfmf:amx file="oracle.dept/ViewController-task-flow.xml#ViewController-task-flow"/>
                    </adfmf:content>
                    </adfmf:feature>
                    </adfmf:features>

                    ---------------------------------------------------------

                    adfmf-application.xml

                    <?xml version="1.0" encoding="UTF-8" ?>
                    <adfmf:application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adfmf="http://xmlns.oracle.com/adf/mf"
                    name="MyMobileApp" id="com.company.MyMobileApp" appControllerFolder="ApplicationController">
                    <adfmf:featureReference id="oracle.dept" loginConnRefId="connection_1"/>
                    </adfmf:application>

                    ----------------------------------------------------------

                    connections.xml

                    <?xml version = '1.0' encoding = 'UTF-8'?>
                    <References xmlns="http://xmlns.oracle.com/adf/jndi">
                    <Reference name="MyDeptWS" className="oracle.adf.model.connection.webservice.impl.WebServiceConnectionImpl" xmlns="">
                    <Factory className="oracle.adf.model.connection.webservice.api.WebServiceConnectionFactory"/>
                    <RefAddresses>
                    <XmlRefAddr addrType="WebServiceConnection">
                    <Contents>
                    <wsconnection description="http://10.177.155.240:7101/WebService-Annotation-context-root/MyCompanyPort?WSDL" service="{http://annotation/}MyCompanyWS">
                    <model name="{http://annotation/}MyCompanyWS" xmlns="http://oracle.com/ws/model">
                    <service name="{http://annotation/}MyCompanyWS">
                    <port name="MyCompanyPort" binding="{http://annotation/}MyCompanyPortBinding">
                    <soap addressUrl="http://10.177.155.240:7101/WebService-Annotation-context-root/MyCompanyPort" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
                    <operation name="setMyDepts">
                    <soap soapAction="" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
                    <output name=""/>
                    <input name=""/>
                    </operation>
                    <operation name="getDeptInfo">
                    <soap soapAction="" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
                    <output name=""/>
                    <input name=""/>
                    </operation>
                    <operation name="addEmployeeToDept">
                    <soap soapAction="" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
                    <output name=""/>
                    <input name=""/>
                    </operation>
                    <operation name="getMyDepts">
                    <soap soapAction="" xmlns="http://schemas.xmlsoap.org/wsdl/soap/"/>
                    <output name=""/>
                    <input name=""/>
                    </operation>
                    </port>
                    </service>
                    </model>
                    </wsconnection>
                    </Contents>
                    </XmlRefAddr>
                    </RefAddresses>
                    </Reference>
                    <Reference name="connection_1" className="oracle.adf.model.connection.adfmf.LoginConnection" adfCredentialStoreKey="connection_1" partial="false" manageInOracleEnterpriseManager="true" deployable="true" xmlns="">
                    <Factory className="oracle.adf.model.connection.adfmf.LoginConnectionFactory"/>
                    <RefAddresses>
                    <XmlRefAddr addrType="adfmfLogin">
                    <Contents>
                    <login url="http://10.177.154.50:7101/adfbasicauth/faces/index.jsf"/>
                    <logout url="http://10.177.154.50:7101/adfbasicauth/faces/index.jsf"/>
                    <accessControl url=""/>
                    <idleTimeout value="300"/>
                    <sessionTimeout value="28800"/>
                    <cookieNames>
                    <cookie name="JSESSIONID"/>
                    </cookieNames>
                    <injectCookiesToRestHttpHeader value="true"/>
                    <userObjectFilter/>
                    </Contents>
                    </XmlRefAddr>
                    </RefAddresses>
                    </Reference>
                    </References>

                    Regards
                    Naveen
                    • 7. Re: ADF Mobile Authentication
                      ArunBabu
                      Try modifying the adfm-application.xml

                      <?xml version="1.0" encoding="UTF-8" ?>
                      <adfmf:application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adfmf="http://xmlns.oracle.com/adf/mf"
                      name="MyMobileApp" id="com.company.MyMobileApp" appControllerFolder="ApplicationController">
                      <adfmf:featureReference id="oracle.dept" loginConnRefId="connection_1"/>
                      <admf:login/>
                      </adfmf:application>
                      • 8. Re: ADF Mobile Authentication
                        Naveen2
                        Tried with that option but still fails to come up with the login page and landing on to the first page of the application directly ...
                        • 9. Re: ADF Mobile Authentication
                          larry.phillips
                          Yes, it works, thank you very much. I should have noticed that it is available in the Expression Builder.
                          • 10. Re: ADF Mobile Authentication
                            ArunBabu
                            Sorry, I got no idea!
                            BTW i hope you noticed there was a typo..
                            it is <adfmf:login/>
                            and not <admf:login/>

                            Also in the login and logout url, please do verify that the ip is correct.
                            Shouldnt it be 127.0.0.1 ?

                            Anyway I dont know anything more..

                            Arun
                            • 11. Re: ADF Mobile Authentication
                              ArunBabu
                              Great that it worked!
                              Why dont you mark it as correct answer so that it could be helpful to others also.. :)

                              Arun