Skip to content

Commit

Permalink
Add device code print to console functionality (#15332)
Browse files Browse the repository at this point in the history
  • Loading branch information
g2vinay authored Sep 28, 2020
1 parent 4bc90ba commit 846265f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@
<suppress checks="MethodName|MemberName|VisibilityModifier|TypeName"
files="com.azure.identity.implementation.WindowsCredentialApi.java"/>

<!-- Need to write to stdout as the default SDK behavior here.-->
<suppress checks="com.azure.tools.checkstyle.checks.GoodLoggingCheck"
files="com.azure.identity.DeviceCodeCredentialBuilder.java"/>


<!-- Use the logger in a Utility static method. -->
<suppress checks="com.azure.tools.checkstyle.checks.GoodLoggingCheck" files="com.azure.ai.formrecognizer.Transforms.java" />
<suppress checks="com\.azure\.tools\.checkstyle\.checks\.(ThrowFromClientLoggerCheck|GoodLoggingCheck)" files="com.azure.ai.formrecognizer.training.models.CopyAuthorization" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
* @see DeviceCodeCredential
*/
public class DeviceCodeCredentialBuilder extends AadCredentialBuilderBase<DeviceCodeCredentialBuilder> {
private Consumer<DeviceCodeInfo> challengeConsumer;
private Consumer<DeviceCodeInfo> challengeConsumer =
deviceCodeInfo -> System.out.println(deviceCodeInfo.getMessage());

private boolean automaticAuthentication = true;

/**
* Sets the consumer to meet the device code challenge.
* Sets the consumer to meet the device code challenge. If not specified a default consumer is used which prints
* the device code info message to stdout.
*
* @param challengeConsumer A method allowing the user to meet the device code challenge.
* @return the InteractiveBrowserCredentialBuilder itself
Expand Down

0 comments on commit 846265f

Please sign in to comment.