Socket
Socket
Sign inDemoInstall

solution-center-login

Package Overview
Dependencies
5
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    solution-center-login

Authentication service for the Zalando Solution Center


Version published
Weekly downloads
22
increased by46.67%
Maintainers
4
Install size
9.55 MB
Created
Weekly downloads
 

Readme

Source

Solution Center Login

Login service to handle authentication in the Zalando Solution Center

Build Status

Changelog

Installation

Install via bower or npm

bower install solution-center-login
npm install solution-center-login

Usage

  1. There is a dependency on Solution Center Communicator. For Bower, if you are using wiredep, the communicator will be loaded automatically. If not, you must manually include the communicator via a <script> tag in your index.html file. This script must be included before the login script:

    <script src="../bower_components/solution-center-communicator/dist/solutioncenter.communicator.js"></script>
    <script src="../node_modules/solution-center-communicator/dist/solutioncenter.communicator.js"></script>
    
  2. Include the login script in your <head> from Bower or NPM:

    <script src="../bower_components/solution-center-login/dist/solutioncenter.login.js"></script>
    <script src="../node_modules/solution-center-login/dist/solutioncenter.login.js"></script>
    

    For Bower, if you are using wiredep, it will be loaded automatically.

  3. Add solutioncenter.login as a module dependency.

    angular.module('my-module', ['solutioncenter.login'])
    
  4. Configure the application by injecting ScAuthenicationServiceProvider in your config block and setting the environment.

    .config(['ScAuthenticationServiceProvider', function(ScAuthenticationServiceProvider) {
        ScAuthenticationServiceProvider.configEnvironment('STAGE');
    }
    

Environment options:

  1. Protect a certain view (or your entire application) by attaching a resolve to the route (works with ngRoute and UI Router).

    resolve: {
        auth : function(ScAuthenticationService) {
            return ScAuthenticationService.requireAuthenticatedUser();
        }
    }
    

### Running locally

When running locally, you need to connect this service to a real (or mocked) login page to handle authentication. You have two options:

#### Run Solution Center locally alongside your application
1. [Run the Solution Center locally from Docker](https://github.bus.zalan.do/norris/solution-center#run-from-docker). Note the port it is running on.
2. Configure solution-center-login to use your local copy for login.

    ```javascript
    ScAuthenticationServiceProvider.configEnvironment('LOCAL', <PORT>, <TOKEN-SERVICE-URL>);
    ```
  * Set `<PORT>` to the port your docker image is running on from step 1 (default: 3333).
  * Set `<TOKEN-SERVICE-URL>` to exactly match the TOKEN_SERVICE_URL you passed in to the docker image in step 1.

#### Mock the Solution Center locally
1. Use any login page you like, as long as it is served locally at `/login`.
2. Call `ScAuthenticationService.silentLogin(email, password)` from the mocked login.
3. Configure solution-center-login to use your local login mock.

    ```javascript
    ScAuthenticationServiceProvider.setInternalCommunication(true);
    ScAuthenticationServiceProvider.configEnvironment('LOCAL', <PORT>, 'your.mocked.token.endpoint');
    ```
  * Set `<PORT>` to the port your application is running on.
  * Note: to work correctly with this library, your mocked token endpoint should conform to our [token API spec](https://token-management.norris.zalan.do/api/index.html#/Token).

### Develop

1. Clone the repository, then run:

  ```shell
  bower install
  npm install
  1. Install Gulp via npm if you don't have it already:
npm install -g gulp
Available commands
  • gulp build: build the project and make new files in dist
  • gulp test: run unit tests

License

MIT

Keywords

FAQs

Last updated on 03 May 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc