npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@natlibfi/passport-atlassian-crowd

v3.0.2

Published

Passport strategy for Atlassian Crowd

Downloads

38

Readme

Passport strategies for Atlassian Crowd NPM Version Build Status

Passport strategies for Atlassian Crowd. There have been many but this module has the following features

  • Written in modern day Javascript/ECMAscript
  • Supports HTTP Basic authentication using username and password OR SSO token transparently
  • Supports HTTP Bearer authentication using Crowd session tokens as bearer tokens
  • Returns user data formatted as common format and protocol for accessing contacts
  • Optional fetching of user group membership

Strategies

This module provides the following Passport strategies

Basic

Authenticates user based on Crowd credentials passed in as Basic HTTP authorization header or Crowd session cookie.

Bearer

HTTP Bearer authentication works by first retrieving a token by using credentials and then using that token in further requests.

Credentials

Used to authenticate using credentials and creating bearer token.

Token

Used to authenticate using bearer token.

Usage

Importing modules

ES modules

import {BasicStrategy} from '@natlibfi/passport-atlassian-crowd';

Node.js require

const {BasicStrategy} = require('@natlibfi/passport-atlassian-crowd');

Basic strategy

Example

import express from 'express';
import passport from 'passport';
import {BasicStrategy} from '@natlibfi/passport-atlassian-crowd';

const app = express();

app.use(passport.initialize());

passport.use(new BasicStrategy({
    url: CROWD_URL, appName: CROWD_APP_NAME, appPassword: CROWD_APP_PASSWORD
}));

app.get('/foo', passport.authenticate('atlassian-crowd-basic', {session: false}));

Configuration

The configuration is passed in to the class constructor in an object which supports the following properties:

  • url: Crowd service URL
  • appName Crowd application name
  • appPassword: Crowd application password
  • ssoCookie (Optional): Name of the SSO cookie. Defaults to crowd.token_key.
  • fetchGroupMembership (Optional): Boolean indicating whether to retrieve group membership or not. Defaults to false.

Bearer strategies

Example

import express from 'express';
import passport from 'passport';
import {BearerCredentialsStrategy, BearerTokenStrategy} from '@natlibfi/passport-atlassian-crowd';

const app = express();

app.use(passport.initialize());

passport.use(new BearerCredentialsStrategy({
    url: CROWD_URL, appName: CROWD_APP_NAME, appPassword: CROWD_APP_PASSWORD
}));

passport.use(new BearerTokenStrategy({
    url: CROWD_URL, appPassword: CROWD_APP_NAME, appPassword: CROWD_APP_PASSWORD
}));

app.post('/auth', passport.authenticate('atlassian-crowd-bearer-credentials', {session: false}));
app.get('/foo', passport.authenticate('atlassian-crowd-bearer-token', {session: false}));

Configuration

The configuration is passed in to the class constructor in an object which supports the following properties:

Credentials

  • url: Crowd service URL
  • appName Crowd application name
  • appPassword: Crowd application password

Token

  • url: Crowd service URL
  • appName Crowd application name
  • appPassword: Crowd application password
  • fetchGroupMembership (Optional): Boolean indicating whether to retrieve group membership or not. Defaults to false.
  • useCache (Optional): Boolean indicating whether to cache tokens and user information. Cache entries will only be removed when token expires. Defaults to false.

User data format

{
  id: '<name>',
  name: {
    givenName: '<first-name>',
	familyName: '<last-name>'
  },
  displayName: '<display-name>',
  emails: [{value: '<payload.email>', type: 'work'}],
  organization: []
}

And with fetchGroupMembership set to true:

{
  id: '<name>',
  name: {
    givenName: '<first-name>',
	familyName: '<last-name>'
  },
  displayName: '<display-name>',
  emails: [{value: '<payload.email>', type: 'work'}],
  organization: [],
  groups: [
      'foo',
      'bar'
  ]
}

License and copyright

Copyright (c) 2019 University Of Helsinki (The National Library Of Finland)

This project's source code is licensed under the terms of MIT license