FAQ/Implementing-Scheduler-Security.md
... ...
@@ -35,6 +35,8 @@ Note: The logic for checking izUser and izPassword from the request MUST precede
35 35
36 36
An example of the logic used to validate izUser and izPassword might look something like the sample below:
37 37
38
+C♯
39
+
38 40
```csharp
39 41
public class CustomAdHocConfig : FileSystemAdHocConfig
40 42
{
... ...
@@ -62,4 +64,37 @@ public class CustomAdHocConfig : FileSystemAdHocConfig
62 64
}
63 65
```
64 66
67
+Visual Basic:
68
+
69
+```visualbasic
70
+<Serializable()> Public Class CustomAdHocConfig
71
+ Inherits FileSystemAdHocConfig
72
+
73
+ Public Shared Sub InitializeReporting()
74
+ If AdHocContext.Initialized Then
75
+ Return
76
+ End If
77
+ AdHocSettings.LicenseKey = "SET_LICENSE_KEY_HERE"
78
+ Dim izUserName As String = String.Empty
79
+ Dim izPassword As String = String.Empty
80
+ If Not String.IsNullOrEmpty(HttpContext.Current.Request("izUser")) Then
81
+ izUserName = HttpContext.Current.Request("izUser")
82
+ End If
83
+ If Not String.IsNullOrEmpty(HttpContext.Current.Request("izPassword")) Then
84
+ izPassword = HttpContext.Current.Request("izPassword")
85
+ End If
86
+ If Not String.IsNullOrEmpty(izUserName) AndAlso Not String.IsNullOrEmpty(izPassword) Then
87
+ If AuthenticateSchedulerUser(izUserName, izPassword) Then ' AuthenticateSchedulerUser Is a Then method that will need To be created specially To handle this Case And returns a Boolean value.
88
+ AdHocSettings.CurrentUserName = izUserName
89
+ End If
90
+ End If
91
+ AdHocSettings.RequireLogin = True
92
+ AdHocSettings.AdHocConfig = New CustomAdHocConfig() ' setting this after RequireLogin will force a redirect If AdHocSettings.CurrentUserName has Not been Set. This assumes that different login logic Handles a standard user login.
93
+ 'continue to initialize normally
94
+ 'Check to see if we've already initialized.
95
+ AdHocContext.Initialized = True
96
+ End Sub
97
+End Class
98
+```
99
+
65 100
The above snippet, in conjunction with the Izenda reports scheduler executable included in starter kits after version 6.10.0.12 (6.10.0.13 and above), will allow the scheduler to bypass the normal RequireLogin setting and schedule reports freely and securely while still requiring any other users to login using the standard mechanism. This example can be modified to meet individual business requirements.
... ...
\ No newline at end of file