2020-05-05 16:29:35 +00:00
|
|
|
import Serializer from './application';
|
|
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/oidc-provider';
|
|
|
|
|
2020-11-09 17:29:12 +00:00
|
|
|
export default class OidcSerializer extends Serializer {
|
|
|
|
primaryKey = PRIMARY_KEY;
|
|
|
|
slugKey = SLUG_KEY;
|
|
|
|
|
|
|
|
respondForAuthorize(respond, serialized, data) {
|
|
|
|
// we avoid the parent serializer here as it tries to create a fingerprint
|
|
|
|
// for an 'action' request but we still need to pass the headers through
|
2020-05-05 16:29:35 +00:00
|
|
|
return respond((headers, body) => {
|
|
|
|
return this.attachHeaders(headers, body, data);
|
|
|
|
});
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
respondForQueryRecord(respond, query) {
|
2020-05-05 16:29:35 +00:00
|
|
|
// add the name and nspace here so we can merge this
|
|
|
|
// TODO: Look to see if we always want the merging functionality
|
2020-11-09 17:29:12 +00:00
|
|
|
return super.respondForQueryRecord(
|
2020-05-05 16:29:35 +00:00
|
|
|
cb =>
|
|
|
|
respond((headers, body) =>
|
|
|
|
cb(headers, {
|
|
|
|
Name: query.id,
|
|
|
|
Namespace: query.ns,
|
2022-01-11 11:02:46 +00:00
|
|
|
Partition: query.partition,
|
2020-05-05 16:29:35 +00:00
|
|
|
...body,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
query
|
|
|
|
);
|
2020-11-09 17:29:12 +00:00
|
|
|
}
|
|
|
|
}
|