예제 #1
0
        static async Task Main(string[] args)
        {
            // クライアントの認証に使用する認証プロバイダを生成
            var authProvider = new MyAuthProvider(ClientId, TenantId, Secret);

            // Microsoft Graphを操作するためのクライアントの生成
            var graphClient = new GraphServiceClient(authProvider);

            // ユーザアカウント一覧の取得
            await GetUserList(graphClient);

            // ユーザアカウントの登録
            var id = await CreateUser(graphClient);

            await GetUser(graphClient, id);

            // ユーザアカウントの更新
            await UpdateUser(graphClient, id);
            await GetUser(graphClient, id);

            // ユーザアカウント(パスワード)の更新
            await UpdateUserPassword(graphClient, id, "newpassword!");

            // ユーザアカウントの削除
            await DeleteUser(graphClient, id);
        }
예제 #2
0
        static void Main()
        {
            MyAuthProvider authProvider = new MyAuthProvider();
            /* Get the client */
            GraphServiceClient graphClient = new GraphServiceClient("https://proxy.apisandbox.msdn.microsoft.com/svc?url=https://graph.microsoft.com/v1.0", authProvider);

            try
            {
                CallWebApi(graphClient).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"There was an exception: {ex}");
            }
        }
예제 #3
0
        public void Configuration(IAppBuilder app)
        {
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            var myProvider = new MyAuthProvider();
            OAuthAuthorizationServerOptions options = new OAuthAuthorizationServerOptions
            {
                AllowInsecureHttp         = true,
                TokenEndpointPath         = new PathString("/login"),
                AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30),
                Provider = myProvider
            };

            app.UseOAuthAuthorizationServer(options);
            app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());


            HttpConfiguration config = new HttpConfiguration();

            WebApiConfig.Register(config);
        }