All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.identity.implementation.models.OidcTokenResponse Maven / Gradle / Ivy

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.identity.implementation.models;

import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;

import java.io.IOException;

public class OidcTokenResponse implements JsonSerializable {
    private String oidcToken;

    public String getOidcToken() {
        return oidcToken;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        return jsonWriter.writeStartObject().writeStringField("oidcToken", oidcToken).writeEndObject();
    }

    public static OidcTokenResponse fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            OidcTokenResponse oidcTokenResponse = new OidcTokenResponse();
            while (JsonToken.END_OBJECT != reader.nextToken()) {
                String fieldName = reader.getFieldName();
                if ("oidcToken".equals(fieldName)) {
                    oidcTokenResponse.oidcToken = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }
            return oidcTokenResponse;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy