Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:37:20+00:00 2026-06-11T06:37:20+00:00

I am developing WebApplication written in Java (JSF 1.2) and I need to implement

  • 0

I am developing WebApplication written in Java (JSF 1.2) and I need to implement new functionality which open other 3rd party WebApplication (in other domain) in new browser window.
I need to login to this 3rd party WebApplication using form POST request.
User in my application should only see a button which should log him to this 3rd party web application.
The problem is, that the user in my web application can not know credentials on which he is login to this 3rd party system.

This is my first dummy solution to this problem:

I added some JavaScript and a button:

<script type='text/javascript'>
  function login(username, password) {
    var action = "https://some.portal.at.other.domain/login.jsp";
    var data = "";
    data = data + "<form name='loginform' action='" + action + "' method='post'>";
    data = data + "  <input id='username' name='username' type='hidden' value='" + username + "' />";
    data = data + "  <input id='password' name='password' type='hidden' value='" + password + "' />";
    data = data + "</form>";
    data = data + "<sc" + "ript type='text/javascript'>";
    data = data + "  document.loginform.submit();";
    data = data + "</sc" + "ript>";
    newWindow=window.open("", "_blank");
    newWindow.document.write(data);
    newWindow.document.close();
  }
</script>

...

<a4j:commandButton id="Login"
                   value="Login"
                   onclick="login('#{user.login}', '#{user.password}')"/> 

This works like a charm, but … when i view html source in a browser, i can see:

<input id="form:Login" name="form:Login" onclick="login('john', 'secret')" value="Login" type="button" />

because JSF evaluate #{user.login} and #{user.password} when page is rendered, so the security is broken 🙂

My question is:
Is it possible to secure this functionality in any way?

I know that if someone have tools like FireBug or WireShark, then he can easily see this POST request if he want, so i feel that this can not be secured in general.
I want to secure this in a way, that it would require more effort to break than simply viewing page source.

I think that i should do something like:
Execute on onclick some ajax request which would return this JavaScript generated in the server side and then evaluate this JavaScript, but i don`t know exactly how to do this.

So guys please send me some advice
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:37:21+00:00Added an answer on June 11, 2026 at 6:37 am

    The only way to secure this type of process is to perform it on the server-side. That is: if the login is happening on the client-side, you must assume that the client has full access to all credentials which are used in the login.

    The standard way to handle this type of situation, where a client-side request is required, but a secret login must happen first, is to have the login happen on the server-side, behind the user’s back, and returning a token which the client can use to authorise a specific request which they are definitely allowed to make.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an ASP.NET forms webapplication using C#. I have a method which creates
I use Spring 3 and Hibernate 3.6 for developing a webapplication - Im new
I'm developing a SharePoint 2010 solution which consists of some web parts and other
Developing web application in Java EE with JSF. All pages are secured from viewing
Im Developing a web application which is very critical. So authentication has to be
I am developing a web application which follows the principle of responsivness. Every information
I'm building a web application which will include functionality that takes MS Word (and
I have been developing a web application for almost a year which I had
i am developing a Webapplication with JSF2 and Spring3 and have a problem with
I'm developing web-application with JSF. I tested it as I was able to but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.