Implement RADIUS server!
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -11,6 +11,7 @@ class ApplicationModel extends Model {
|
||||
ldap_client_ids: [String],
|
||||
oauth_client_ids: [String],
|
||||
openid_client_ids: [String],
|
||||
radius_client_ids: [String],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +25,7 @@ class ApplicationModel extends Model {
|
||||
ldap_client_ids: this.ldap_client_ids,
|
||||
oauth_client_ids: this.oauth_client_ids,
|
||||
openid_client_ids: this.openid_client_ids,
|
||||
radius_client_ids: this.radius_client_ids || [],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
app/models/radius/Client.model.js
Normal file
32
app/models/radius/Client.model.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const { Model } = require('flitter-orm')
|
||||
const {v4: uuid} = require("uuid");
|
||||
|
||||
class Client extends Model {
|
||||
static get services() {
|
||||
return [...super.services, 'models']
|
||||
}
|
||||
|
||||
static get schema() {
|
||||
return {
|
||||
name: String,
|
||||
secret: {type: String, default: uuid},
|
||||
active: {type: Boolean, default: true},
|
||||
}
|
||||
}
|
||||
|
||||
async application() {
|
||||
const Application = this.models.get('Application')
|
||||
return Application.findOne({ active: true, radius_client_ids: this.id })
|
||||
}
|
||||
|
||||
async to_api() {
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
secret: this.secret,
|
||||
active: this.active,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = Client
|
||||
Reference in New Issue
Block a user