1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-07 22:50:05 +00:00

feat: implemented LDAP authentication

This commit is contained in:
2022-09-29 18:41:28 +05:00
parent 375f924f45
commit f915c51b07
21 changed files with 1001 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
import mongoose, { Schema, model, Document, Model } from 'mongoose'
import { GroupDetailsResponse } from '../controllers'
import User, { IUser } from './User'
import { AuthProviderType } from '../utils'
const AutoIncrement = require('mongoose-sequence')(mongoose)
export const PUBLIC_GROUP_NAME = 'Public'
@@ -16,6 +17,11 @@ export interface GroupPayload {
* @example "This group represents Data Controller Users"
*/
description: string
/**
* Identifies the source from which group is created
* @example "false"
*/
authProvider?: AuthProviderType
/**
* Group should be active or not, defaults to true
* @example "true"
@@ -46,6 +52,11 @@ const groupSchema = new Schema<IGroupDocument>({
type: String,
default: 'Group description.'
},
authProvider: {
type: String,
enum: AuthProviderType,
default: 'internal'
},
isActive: {
type: Boolean,
default: true

View File

@@ -1,6 +1,7 @@
import mongoose, { Schema, model, Document, Model } from 'mongoose'
const AutoIncrement = require('mongoose-sequence')(mongoose)
import bcrypt from 'bcryptjs'
import { AuthProviderType } from '../utils'
export interface UserPayload {
/**
@@ -17,6 +18,11 @@ export interface UserPayload {
* Password for user
*/
password: string
/**
* Identifies the source from which user is created
* @example "internal"
*/
authProvider?: AuthProviderType
/**
* Account should be admin or not, defaults to false
* @example "false"
@@ -67,6 +73,11 @@ const userSchema = new Schema<IUserDocument>({
type: String,
required: true
},
authProvider: {
type: String,
enum: AuthProviderType,
default: 'internal'
},
isAdmin: {
type: Boolean,
default: false