-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSampleApiProject.cs
101 lines (92 loc) · 3.42 KB
/
SampleApiProject.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#region Copyright 2024 One Identity LLC.
/*
* ONE IDENTITY LLC. PROPRIETARY INFORMATION
*
* This software is confidential. One Identity, LLC. or one of its affiliates or
* subsidiaries, has supplied this software to you under terms of a
* license agreement, nondisclosure agreement or both.
*
* You may not copy, disclose, or use this software except in accordance with
* those terms.
*
*
* Copyright 2024 One Identity LLC.
* ALL RIGHTS RESERVED.
*
* ONE IDENTITY LLC. MAKES NO REPRESENTATIONS OR
* WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT. ONE IDENTITY LLC. SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
#endregion
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using QBM.CompositionApi.ApiManager;
using QBM.CompositionApi.Config;
using QBM.CompositionApi.Definition;
using QBM.CompositionApi.Session;
using VI.Base;
// This attribute will automatically assign all methods defined in this DLL to the CCC (customer)
// module of Identity Manager.
// Associating API methods with an Identity Manager module is important for correct API client generation,
// as API clients are defined by module.
[assembly:QBM.CompositionApi.PlugIns.Module("CCC")]
namespace Api
{
public class PluginMethodSetProvider : IPlugInMethodSetProvider
{
public IMethodSetProvider Build(IResolve resolver)
{
return new SampleApiProject(resolver);
}
}
internal class SampleApiProject : IMethodSetProvider
{
private readonly IResolve _resolver;
public SampleApiProject(IResolve resolver)
{
_resolver = resolver;
}
public Task<IEnumerable<IMethodSet>> GetMethodSetsAsync(CancellationToken ct = new CancellationToken())
{
var methodSet = new MethodSet
{
AppId = "custom",
};
var svc =_resolver.Resolve<IExtensibilityService>();
var apiProvidersByAttribute = svc.FindAttributeBasedApiProviders<SampleApiProject>();
methodSet.Configure(_resolver, apiProvidersByAttribute);
var authConfig = new SessionAuthDbConfig
{
AuthenticationType = AuthType.AllManualModules,
// Insert the name of the product to use for authentication
Product = "Portal",
SsoAuthentifiers =
{
// Add the names of any single-sign-on authentifiers here.
// Do not add any OAuth modules here, as OAuth requires a different
// authentication flow.
},
ExcludedAuthentifiers =
{
// Add the names of any excluded authentication modules here
}
};
// To explicitly set the list allowed authentication modules,
// set the AuthenticationType to AuthType.Default and set
// the list of ManualAuthentifiers.
methodSet.SessionConfig = authConfig;
return Task.FromResult<IEnumerable<IMethodSet>>(new[]
{
methodSet
});
}
}
}