diff --git a/src/Authentication/Authentication.Core/Common/GraphSession.cs b/src/Authentication/Authentication.Core/Common/GraphSession.cs
index 9de7e41c12d..e88356c011d 100644
--- a/src/Authentication/Authentication.Core/Common/GraphSession.cs
+++ b/src/Authentication/Authentication.Core/Common/GraphSession.cs
@@ -6,6 +6,7 @@ namespace Microsoft.Graph.PowerShell.Authentication
{
using Microsoft.Graph.PowerShell.Authentication.Core;
using Microsoft.Graph.PowerShell.Authentication.Interfaces;
+
using System;
using System.Security;
using System.Threading;
@@ -200,5 +201,22 @@ public static void Reset()
throw new InvalidOperationException(ErrorConstants.Codes.SessionLockWriteDisposed, disposedException);
}
}
+
+ private IPSGraphOutputWriter _outputWriter;
+ ///
+ /// Provides Access to output methods provided by the Cmdlet
+ ///
+ public IPSGraphOutputWriter OutputWriter
+ {
+ get
+ {
+ if (_outputWriter == null)
+ {
+ throw new InvalidOperationException(ErrorConstants.Codes.OutputNotInitialized);
+ }
+ return _outputWriter;
+ }
+ set => _outputWriter = value;
+ }
}
}
diff --git a/src/Authentication/Authentication.Core/ErrorConstants.cs b/src/Authentication/Authentication.Core/ErrorConstants.cs
index 3ee456579e6..6ba7e41f631 100644
--- a/src/Authentication/Authentication.Core/ErrorConstants.cs
+++ b/src/Authentication/Authentication.Core/ErrorConstants.cs
@@ -15,6 +15,7 @@ internal static class Codes
internal const string SessionLockWriteDisposed = "sessionLockWriteDisposed";
internal const string SessionLockWriteRecursion = "sessionLockWriteRecursion";
internal const string InvalidJWT = "invalidJWT";
+ internal const string OutputNotInitialized = "outputNotInitialized";
}
public static class Message
diff --git a/src/Authentication/Authentication.Core/Interfaces/IAuthContext.cs b/src/Authentication/Authentication.Core/Interfaces/IAuthContext.cs
index 11994fd0b35..edcc613e11e 100644
--- a/src/Authentication/Authentication.Core/Interfaces/IAuthContext.cs
+++ b/src/Authentication/Authentication.Core/Interfaces/IAuthContext.cs
@@ -18,6 +18,7 @@ public enum ContextScope
Process,
CurrentUser
}
+
public enum AuthProviderType
{
InteractiveAuthenticationProvider,
@@ -26,6 +27,7 @@ public enum AuthProviderType
ClientCredentialProvider,
UserProvidedToken
}
+
public interface IAuthContext
{
string ClientId { get; set; }
@@ -40,4 +42,4 @@ public interface IAuthContext
ContextScope ContextScope { get; set; }
X509Certificate2 Certificate { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/src/Authentication/Authentication.Core/Interfaces/IPSGraphOutputWriter.cs b/src/Authentication/Authentication.Core/Interfaces/IPSGraphOutputWriter.cs
new file mode 100644
index 00000000000..bca5a01bbdb
--- /dev/null
+++ b/src/Authentication/Authentication.Core/Interfaces/IPSGraphOutputWriter.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Microsoft.Graph.PowerShell.Authentication
+{
+ public interface IPSGraphOutputWriter
+ {
+ Action WriteObject { get; set; }
+ Action WriteDebug { get; set; }
+ Action WriteError { get; set; }
+ Action