What steps should be taken for the authentication process when using Active Directory (with LDAP) with an AngularJS/JavaScript frontend?

Currently, I am tackling a project that involves authenticating users in an application using their Windows credentials. The frontend is built with AngularJS and the backend with Java.

After conducting extensive research, I came to the realization that it is not feasible for the frontend to directly retrieve the user's Windows username & password due to security reasons.

However, I believe the initial step should be taken from the frontend by obtaining these encrypted credentials or possibly a token, then forwarding them to the backend to initiate the NTLM authentication process.

I am uncertain whether the user should manually log into the app with their Windows credentials or if it should be automatically authenticated through NTLM passthrough.

I lack a solid understanding of this concept as most resources I found predominantly focus on backend solutions (mostly C#), leaving minimal information on frontend approaches. Therefore, I seek some guidance on this matter. Is there a middleware or npm package that can assist me in acquiring the username & password, or do you have any recommendations?

Answer №1

When it comes to web servers, they provide access to server variables for code processing requests.

In my case, using IIS, you can find more information about these server variables here: https://learn.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524602%28v%3dvs.90%29

Since I am utilizing IISNode, which integrates node.js environment within IIS, I have access to these server variables. Different programming languages may have their own methods to access these variables, as mentioned in the link provided.

It is likely that Java also provides similar server variables. The specifics of the code you need will depend on your backend setup.

A quick search for "java server variables" leads me to resources like:

https://docs.oracle.com/cd/E19534-01/820-3288/gawim/index.html for Java Access Manager.

for traditional JSP.

How can I obtain server variables using apache wicket 1.54? for Java Wicket server.

Refer to the documentation of your specific web server software or Java API for a comprehensive list and example codes on accessing these variables.

Once you retrieve this data on the server side, you can perform an LDAP query and return the results to the client side.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to activate the browser's spell check feature in TinyMCE Richtext editor when integrated with AngularJS?

I have integrated TinyMCE text editor into my application with angularjs. I am looking to enable the browser's spell check feature. Even though it is a text area, the spell check functionality does not seem to work by default as it would in a normal t ...

search engine optimized for easy input via keyboard

I have successfully incorporated AJAX search functionality into my project, inspired by this example here. The unique feature of this implementation is the ability to navigate through search results using the TAB key. The structure of my search results tab ...

The Java function is returning a null array of class variables outside of its scope

I'm facing an issue in my Java class where I declare a class as an array and assign values to it within a function, but when attempting to access the array outside of the function, it returns null. How can I properly access the class array? The decla ...

The functionality of .map() in Javascript is non-existent

I am completely new to this community (and JavaScript is also new for me), so I apologize in advance for asking some very basic questions. I have an HTML page with various images, all of which share a common class. After using getElementsByClassName, I obt ...

Is it necessary for karma.conf.js to be located at the root of the application at all times?

My experience with building ng applications using just Angular has been centered around a typical structure like this: app js home home.controller.js home.directive.js shared usedByAll.cont ...

Why does the removeChild method in JavaScript consistently remove the last child element, rather than the one specified by its ID?

There are four divs with an event listener onclick, triggering a JavaScript function that simply removes the clicked div: this.parentNode.removeChild(this); Although it should remove the specific div clicked on, it instead deletes the last child and alte ...

Invert the polarity of an angular.js filtering function

Is it achievable to trigger the reverse of a filter method in HTML, such as utilizing: "item in items | filter:!AllDay" rather than "item in items | filter:AllDay" ? Or must you sustain two distinct filter methods (one for false and one for true)? ...

When attempting to execute Protractor tests, an error occurs stating that the object #<Object> does not possess the 'getInstance' method

Whenever I try to run my Protractor tests from the command line, all of them fail because the protractor object does not have the necessary methods. The error message I receive is: TypeError: Object # has no method 'getInstance' Although this ...

Utilizing the power of Selenium WebDriver for choosing a specific date

Hey there, I am new to Selenium and struggling with selecting a date on the website . Can anyone provide some guidance? I attempted to input a value into the read-only text box, but was unsuccessful. public static void setup() throws Exception { Sys ...

Utilizing JavaScript AJAX to upload a dynamically generated PDF file to a specific directory on the server

Looking for a solution to save a complex table generated via JavaScript as a PDF on the server. Existing pdf generation libraries have limitations with style and fonts, making it difficult for 'complex' tables. The table can currently be download ...

Are there any other options similar to PhantomJs that offer support for CSS 3D effects?

I am working on capturing a webpage using NodeJs. My current setup involves using PhantomJs to capture screenshots of the page and ffmpeg to convert them into videos. However, I have encountered an issue where the page contains 3D transform CSS, which is n ...

The present URL of Next.js version 13

When working with Next.js App Router in SSR, how can I retrieve the complete URL of the current page? I am unable to use window.location.href due to the absence of a defined window object, and using useRouter() does not provide access to the full URL. ...

A guide to implementing polymorphic serialization without the use of annotations or mixins

In the city of Jackson, we have the option to utilize certain annotations: @JsonTypeInfo @JsonSubTypes @JsonSubTypes.Type These can be used for polymorphic serialization. We have two choices: Applying these annotations directly on the data model, which ...

Encountering an error with BOLDWEIGHT that cannot be resolved or identified as a field, along with SOLID_FOREGROUND experiencing a similar issue of resolution or field

Encountering an issue where BOLDWEIGHT_BOLD cannot be resolved or is not a field, along with SOLID_FOREGROUND cannot be resolved or is not a field. This is the original content of my Generic.java file: package com.expertus.libraries; import java.io.File ...

The JS slider fails to function properly following the migration of AngularJS from version 1.0.8 to 1.2

Seeking assistance with migrating AngularJS from version 1.0.8 to 1.2 and encountering issues with a JavaScript slider that is no longer functioning post-migration... After upgrading to 1.2, added the angular-route.js library and injected 'ngRoute&ap ...

What is the best way to set the input type in AngularJS based on a variable?

Is there a way to dynamically set the input type based on another variable in AngularJS? I was considering using a directive that triggers from an onclick event to change the input type, but I'm not entirely sure. FIRST //loop <a class="orgTitle" ...

intervals should not be attached after being cleared by a condition

I am facing an issue with my slider that has a play button to change the slide image and a pause button. When I click on play, it functions as intended. However, when I pause and try to play again, it does not work. Although I clear the interval using th ...

Have you attempted to configure a JSON file to facilitate language translations?

I need some guidance on structuring my data.json file efficiently. Currently, it is set up as shown in the example below. The goal is to have a drop-down menu where users can select a language and then display 50 different pages with specific content. I wa ...

I am facing issues with getting the delete function to properly function in my React

Issue with Delete Button Functionality in React While I am able to successfully delete an item using axios call in Postman, implementing the same functionality on the front-end in a React component seems to be causing problems for me. <button onSubmit ...

Auto-selecting the first item in a CSS menu when the switcher is tapped on mobile devices

Struggling with a responsive CSS menu on my website, . The switcher on mobile seems to automatically click the first item in the menu (Home) as I open it, redirecting me instantly. When setting the link to "#" everything is fine, but then I lose the home l ...