WebAuthenticationBroker 클래스

정의

인증 작업을 시작합니다. 단일 애플리케이션 또는 여러 애플리케이션에서 동시에 이 클래스의 메서드를 여러 번 호출할 수 있습니다. 샘플 갤러리의 웹 인증 브로커 샘플 은 SSO(Single Sign-On) 연결에 WebAuthenticationBroker 클래스를 사용하는 방법의 예입니다.

public ref class WebAuthenticationBroker abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class WebAuthenticationBroker final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class WebAuthenticationBroker
Public Class WebAuthenticationBroker
상속
Object Platform::Object IInspectable WebAuthenticationBroker
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)
앱 기능
internetClient

예제

private void OutputToken(String TokenUri)
{
   Page outputFrame = (Page)rootPage.OutputFrame.Content;
   TextBox FacebookReturnedToken = outputFrame.FindName("FacebookReturnedToken") as TextBox;
   FacebookReturnedToken.Text = TokenUri;
}


try
{
    String FacebookURL = "https://www.facebook.com/dialog/oauth?client_id=" + FacebookClientID.Text + "&redirect_uri=" + Uri.EscapeUriString(FacebookCallbackUrl.Text) + "&scope=read_stream&display=popup&response_type=token";

    System.Uri StartUri = new Uri(FacebookURL);
    System.Uri EndUri = new Uri(FacebookCallbackUrl.Text);

    WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
                                            WebAuthenticationOptions.None,
                                            StartUri,
                                            EndUri);
    if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
    {
        OutputToken(WebAuthenticationResult.ResponseData.ToString());
    }
    else if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
    {
        OutputToken("HTTP Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseErrorDetail.ToString());
    }
    else
    {
        OutputToken("Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseStatus.ToString());
    }
}
catch (Exception Error)
{
    //
    // Bad Parameter, SSL/TLS Errors and Network Unavailable errors are to be handled here.
    //
}
<TextBlock x:Name="InputTextBlock1"  TextWrapping="Wrap" Grid.Row="0" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" > 
    Connect to Facebook using the OAuth 2.0 protocol for authentication and authorization. 
</TextBlock> 
<StackPanel Orientation="Vertical" Margin="0,10,0,0" Grid.Row="1"> 
    <StackPanel Orientation="Horizontal"> 
        <TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}" Text="App ID   : " VerticalAlignment="Bottom"/> 
        <TextBox x:Name="FacebookClientID" Height="14" Width="173" Text=""/> 
    </StackPanel> 
    <StackPanel Orientation="Horizontal"> 
        <TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}" Text="Site URL : " VerticalAlignment="Bottom"/> 
        <TextBox x:Name="FacebookCallbackUrl" Height="14" Width="433" Text=""/> 
    </StackPanel> 
    <StackPanel Orientation="Vertical" Margin="0,10,0,0"> 
        <Button x:Name="Launch" Content="Launch" Margin="0,0,10,0" Click="Launch_Click"/> 
    </StackPanel> 
</StackPanel>  

설명

이 클래스의 모든 멤버는 정적입니다. 개체를 만들지 않고 액세스할 수 있습니다. 이 클래스를 사용할 때 발생하는 문제를 해결하려면 이벤트 로그를 참조하세요. 이벤트 로그를 보려면 Eventvwr.exe 시작하고 애플리케이션 및 서비스 로그 > Microsoft > Windows > WebAuth > Operational으로 이동합니다.

메서드

AuthenticateAndContinue(Uri)

하나의 입력으로 인증 작업을 시작합니다.

AuthenticateAndContinue(Uri, Uri)

두 개의 입력으로 인증 작업을 시작합니다.

AuthenticateAndContinue(Uri, Uri, ValueSet, WebAuthenticationOptions)

네 개의 입력으로 인증 작업을 시작합니다.

AuthenticateAsync(WebAuthenticationOptions, Uri)

두 개의 입력으로 비동기 인증 작업을 시작합니다. 단일 애플리케이션 또는 여러 애플리케이션에서 동시에 이 메서드를 여러 번 호출할 수 있습니다.

AuthenticateAsync(WebAuthenticationOptions, Uri, Uri)

세 개의 입력으로 비동기 인증 작업을 시작합니다. 단일 애플리케이션 또는 여러 애플리케이션에서 동시에 이 메서드를 여러 번 호출할 수 있습니다.

AuthenticateSilentlyAsync(Uri)

하나의 입력으로 비동기 인증 작업을 자동으로 시작합니다(UI가 표시되지 않음). 단일 애플리케이션 또는 여러 애플리케이션에서 동시에 이 메서드를 여러 번 호출할 수 있습니다.

AuthenticateSilentlyAsync(Uri, WebAuthenticationOptions)

두 개의 입력으로 비동기 인증 작업을 자동으로 시작합니다(UI가 표시되지 않음). 단일 애플리케이션 또는 여러 애플리케이션에서 동시에 이 메서드를 여러 번 호출할 수 있습니다.

GetCurrentApplicationCallbackUri()

현재 애플리케이션 콜백 URI를 가져옵니다.

적용 대상

추가 정보