Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
cordova-plugin-ms-adal
Advanced tools
Active Directory Authentication Library (ADAL) plugin provides easy to use authentication functionality for your Apache Cordova apps by taking advantage of Windows Server Active Directory and Windows Azure Active Directory. Here you can find the source code for the library.
This plugin uses native SDKs for ADAL for each supported platform and provides single API across all platforms. Here is a quick usage sample:
var AuthenticationContext = Microsoft.ADAL.AuthenticationContext;
AuthenticationContext.createAsync(authority)
.then(function (authContext) {
authContext.acquireTokenAsync(resourceUrl, appId, redirectUrl)
.then(function (authResponse) {
console.log("Token acquired: " + authResponse.accessToken);
console.log("Token will expire on: " + authResponse.expiresOn);
}, fail);
}, fail);
Note: You can use AuthenticationContext
synchronous constructor as well:
authContext = new AuthenticationContext(authority);
authContext.acquireTokenAsync(resourceUrl, appId, redirectUrl).then(function (authRes) {
console.log(authRes.accessToken);
...
});
For more API documentation see sample application and JSDoc for exposed functionality stored in www subfolder.
Cordova CLI can be easily installed via NPM package manager: npm install -g cordova
Additional prerequisites for each target platform can be found at Cordova platforms documentation page.
Clone plugin repository into a directory of your choice
git clone https://github.com/AzureAD/azure-activedirectory-library-for-cordova.git
Create a project and add the platforms you want to support
cordova create ADALSample --copy-from="azure-activedirectory-library-for-cordova/sample"
cd ADALSample
cordova platform add android
cordova platform add ios
cordova platform add windows
Add the plugin to your project
cordova plugin add ../azure-activedirectory-library-for-cordova
Build and run application: cordova run
.
You can find detailed instructions how to set up a new application in Azure AD here.
This plugin contains test suite, based on Cordova test-framework plugin. The test suite is placed under tests
folder at the root or repo and represents a separate plugin.
To run the tests you need to create a new application as described in Installation Instructions section and then do the following steps:
Add test suite to application
cordova plugin add ../azure-activedirectory-library-for-cordova/tests
Update application's config.xml file: change <content src="index.html" />
to <content src="cdvtests/index.html" />
Change AD-specific settings for test application at the beginning of plugins\cordova-plugin-ms-adal\www\tests.js
file. Update AUTHORITY_URL
, RESOURCE_URL
, REDIRECT_URL
, APP_ID
to values, provided by your Azure AD. For instructions how to setup an Azure AD application see Setting up an Application in Azure AD section.
Build and run application.
There is currently a Cordova issue, which entails the need of the hook-based workaround. The workaround is to be discarded after a fix is applied.
To use ADFS/SSO on Windows platform (Windows Phone 8.1 is not supported for now) add the following preference into config.xml
:
<preference name="adal-use-corporate-network" value="true" />
adal-use-corporate-network
is false
by default.
It will add all needed application capabilities and toggle authContext to support ADFS. You can change its value to false
and back later, or remove it from config.xml
- call cordova prepare
after it to apply the changes.
Note: You should not normally use adal-use-corporate-network
as it adds capabilities, which prevents an app from being published in the Windows Store.
Note: In case if you have a Visual Studio 2015 Preview installed you may have issues with project packaging for Windows related to MSBuild v.14 issue. You can workaround this issue by using patched cordova-windows with MSBuild reverted to v.12:
cordova platform add windows
usegit clone -b msbuild14-issue https://github.com/MSOpenTech/cordova-windows
cordova platform add ..\cordova-windows
Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
FAQs
Provides Microsoft Azure Active Directory (ADAL) OAuth client.
The npm package cordova-plugin-ms-adal receives a total of 55 weekly downloads. As such, cordova-plugin-ms-adal popularity was classified as not popular.
We found that cordova-plugin-ms-adal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.