Skip to content

Commit

Permalink
Merge 1204a2a into 469c6be
Browse files Browse the repository at this point in the history
  • Loading branch information
meabed committed Jul 16, 2020
2 parents 469c6be + 1204a2a commit 1908870
Show file tree
Hide file tree
Showing 133 changed files with 9,041 additions and 2,455 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ coverage
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

build
types/

.yarnclean
Expand All @@ -33,4 +32,4 @@ types/

*.tgz

package-lock.json
package-lock.json
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ node_modules
examples
test
@types
types
src
docs
yarn*
.nyc_output
.nyc_output
.idea
.travis.yml
.github
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
.nyc_output
node_modules
types
docs
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ script:

branches:
only:
- master
- /^.*-alpha$/
- /^.*-rc.*$/
- /^feature\/.*$/
- master
- /^.*-alpha$/
- /^.*-rc.*$/
- /^feature\/.*$/

after_success: npm run coverage
after_success: npm run coverage
27 changes: 21 additions & 6 deletions @types/xml-encryption.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,27 @@ declare module "xml-encryption" {
key: string | Buffer;
}
export interface Callback {
(err:Error, result): void;
(err: Error, result): void;
}
export function encrypt(content: string, options: EncryptOptions, callback: Callback): string;
export function encryptKeyInfo(symmetricKey: string, options: EncryptOptions, callback: Callback): string;
export function decrypt(xml: string | Document, options: DecryptOptions, callback: Callback): string;
export function decryptKeyInfo(doc: string | Document, options: DecryptOptions): string;
const _default: { decrypt, encrypt, decryptKeyInfo, encryptKeyInfo };
export function encrypt(
content: string,
options: EncryptOptions,
callback: Callback
): string;
export function encryptKeyInfo(
symmetricKey: string,
options: EncryptOptions,
callback: Callback
): string;
export function decrypt(
xml: string | Document,
options: DecryptOptions,
callback: Callback
): string;
export function decryptKeyInfo(
doc: string | Document,
options: DecryptOptions
): string;
const _default: { decrypt; encrypt; decryptKeyInfo; encryptKeyInfo };
export default _default;
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-present Tony Ngan
Copyright (c) 2020-present Meabed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# samlify ·
# samlify-js ·

[![Build Status](https://travis-ci.org/tngan/samlify.svg?branch=master)](https://travis-ci.org/tngan/samlify)
[![npm version](https://img.shields.io/npm/v/samlify.svg?style=flat)](https://www.npmjs.com/package/samlify)
[![Coverage Status](https://img.shields.io/coveralls/tngan/samlify/master.svg)](https://coveralls.io/github/tngan/samlify?branch=master)
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/samlify)

-----
## Fork with typescript fixes, packages upgrade and faster bug fixes.
-----

Highly configuarable Node.js SAML 2.0 library for Single Sign On

## Welcome PRs

Welcome all PRs for maintaining this project, or provide a link to the repositories especially for use cases alongside with different frameworks.

### Sponsor

| <img width="50" src="https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png"> | <div style="text-align: left;">If you want to quickly implement SAML SSO, feel free to check out Auth0's NodeJS SDK and free plan at [auth0.com/overview](https://auth0.com/overview?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=samlify&utm_content=auth).</div> |
| :----------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |


### Installation

Expand All @@ -24,8 +23,8 @@ To install the stable version
Starting from v2.6, multiple schema validators are now supported. You can simply set the validator via the following global method. We have four validator modules right now, and you can write your own. The `setSchemaValidator` is required since v2.6, it will throw error if you don't set at the beginning.

```js
import * as samlify from 'samlify';
import * as validator from '@authenio/samlify-xsd-schema-validator';
import * as samlify from "samlify-js";
import * as validator from "@authenio/samlify-xsd-schema-validator";
// import * as validator from '@authenio/samlify-validate-with-xmllint';
// import * as validator from '@authenio/samlify-node-xmllint';
// import * as validator from '@authenio/samlify-libxml-xsd'; // only support for version of nodejs <= 8
Expand All @@ -42,10 +41,10 @@ Now you can create your own schema validator and even suppress it but you have t

```typescript
samlify.setSchemaValidator({
validate: (response: string) => {
/* implment your own or always returns a resolved promise to skip */
return Promise.resolve('skipped');
}
validate: (response: string) => {
/* implment your own or always returns a resolved promise to skip */
return Promise.resolve("skipped");
},
});
```

Expand All @@ -67,7 +66,7 @@ yarn
### Get Started

```javascript
const saml = require('samlify');
const saml = require("samlify-js");
```

See full documentation [here](https://samlify.js.org/)
Expand Down
8 changes: 8 additions & 0 deletions build/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface Context extends ValidatorContext {
}
interface ValidatorContext {
validate?: (xml: string) => Promise<any>;
}
export declare function getContext(): Context;
export declare function setSchemaValidator(params: ValidatorContext): void;
export {};
19 changes: 19 additions & 0 deletions build/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/api.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions build/binding-post.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @file binding-post.ts
* @author tngan
* @desc Binding-level API, declare the functions using POST binding
*/
import { BindingContext } from "./entity";
/**
* @desc Generate a base64 encoded login request
* @param {string} referenceTagXPath reference uri
* @param {object} entity object includes both idp and sp
* @param {function} customTagReplacement used when developers have their own login response template
*/
declare function base64LoginRequest(referenceTagXPath: string, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
/**
* @desc Generate a base64 encoded login response
* @param {object} requestInfo corresponding request, used to obtain the id
* @param {object} entity object includes both idp and sp
* @param {object} user current logged user (e.g. req.user)
* @param {function} customTagReplacement used when developers have their own login response template
* @param {boolean} encryptThenSign whether or not to encrypt then sign first (if signing). Defaults to sign-then-encrypt
*/
declare function base64LoginResponse(requestInfo: any, entity: any, user?: any, customTagReplacement?: (template: string) => BindingContext, encryptThenSign?: boolean): Promise<BindingContext>;
/**
* @desc Generate a base64 encoded logout request
* @param {object} user current logged user (e.g. req.user)
* @param {string} referenceTagXPath reference uri
* @param {object} entity object includes both idp and sp
* @param {function} customTagReplacement used when developers have their own login response template
* @return {string} base64 encoded request
*/
declare function base64LogoutRequest(user: any, referenceTagXPath: any, entity: any, customTagReplacement?: (template: string) => BindingContext): BindingContext;
/**
* @desc Generate a base64 encoded logout response
* @param {object} requestInfo corresponding request, used to obtain the id
* @param {object} entity object includes both idp and sp
* @param {function} customTagReplacement used when developers have their own login response template
*/
declare function base64LogoutResponse(requestInfo: any, entity: any, customTagReplacement: (template: string) => BindingContext): BindingContext;
declare const postBinding: {
base64LoginRequest: typeof base64LoginRequest;
base64LoginResponse: typeof base64LoginResponse;
base64LogoutRequest: typeof base64LogoutRequest;
base64LogoutResponse: typeof base64LogoutResponse;
};
export default postBinding;
Loading

0 comments on commit 1908870

Please sign in to comment.