feat(Docuware): refs #8066 use oath
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-10-07 15:14:03 +02:00
parent 1205475c4c
commit 952f8f3dfc
1 changed files with 12 additions and 2 deletions

View File

@ -8,12 +8,22 @@ module.exports = Self => {
* @return {object} - The headers
*/
Self.getOptions = async() => {
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
const {url, username, password} = await Self.app.models.DocuwareConfig.findOne();
const {IdentityServiceUrl} = await axios.get(`${url}/Home/IdentityServiceInfo`);
const {token_endpoint} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
const {access_token} = await axios.post(token_endpoint, {
grant_type: 'password',
scope: 'docuware.platform',
client_id: 'docuware.platform.net.client',
username, // falta añadirlos
password // falta añadirlos
});
const headers = {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Cookie': docuwareConfig.cookie
'access_token': access_token
}
};