/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */

syntax = "proto3";

option java_multiple_files = true;
package org.apache.custos.core.identity.api;


message AuthToken {
    string access_token = 1;
    repeated Claim claims = 2;
}

message Claim {
    string key = 1;
    string value = 2;
}

message User {
    string sub = 1;
    string full_name = 2;
    string first_name = 3;
    string last_name = 4;
    string email_address = 5;
    string username = 6;
    string client_id = 7;
}


message GetTokenRequest {
    int64 tenant_id = 1;
    string client_id = 2;
    string client_secret = 3;
    string redirect_uri = 4;
    string code = 6;
    string username = 7;
    string password = 8;
    string refresh_token = 9;
    string grant_type = 10;
    string code_verifier = 11;
}

message TokenResponse {
    string access_token = 1;
    int32 expires_in = 2;
    int32 refresh_expires_in = 3;
    string refresh_token = 4;
    string token_type = 5;
    string id_token = 6;
    int32 not_before_policy = 7;
    string session_state = 8;
    string scope = 9;
}

message OIDCConfiguration {
    string issuer = 1;
    string authorization_endpoint = 2;
    string token_endpoint = 3;
    string userinfo_endpoint = 4;
    string jwks_uri = 5;
    repeated string response_types_supported = 6;
    repeated string subject_types_supported = 7;
    repeated string id_token_signing_alg_values_supported = 8;
    repeated string scopes_supported = 9;
    repeated string token_endpoint_auth_methods_supported = 10;
    repeated string claims_supported = 11;
    repeated string introspection_endpoint_auth_signing_alg_values_supported = 12;
    bool request_parameter_supported = 13;
    string pushed_authorization_request_endpoint = 14;
    string introspection_endpoint = 15;
    bool claims_parameter_supported = 16;
    repeated string id_token_encryption_enc_values_supported = 17;
    repeated string userinfo_encryption_enc_values_supported = 18;
    repeated string introspection_endpoint_auth_methods_supported = 19;
    repeated string authorization_encryption_alg_values_supported = 20;
    bool tls_client_certificate_bound_access_tokens = 21;
    repeated string response_modes_supported = 22;
    bool backchannel_logout_session_supported = 23;
    repeated string backchannel_authentication_request_signing_alg_values_supported = 24;
    repeated string authorization_encryption_enc_values_supported = 25;
    repeated string revocation_endpoint_auth_signing_alg_values_supported = 26;
    repeated string backchannel_token_delivery_modes_supported = 27;
    repeated string revocation_endpoint_auth_methods_supported = 28;
    bool request_uri_parameter_supported = 29;
    repeated string grant_types_supported = 30;
    bool require_request_uri_registration = 31;
    repeated string code_challenge_methods_supported = 32;
    repeated string id_token_encryption_alg_values_supported = 33;
    bool frontchannel_logout_session_supported = 34;
    repeated string authorization_signing_alg_values_supported = 35;
    repeated string request_object_signing_alg_values_supported = 36;
    repeated string request_object_encryption_alg_values_supported = 37;
    string check_session_iframe = 38;
    bool backchannel_logout_supported = 40;
    repeated string acr_values_supported = 41;
    repeated string request_object_encryption_enc_values_supported = 42;
    string device_authorization_endpoint = 43;
    repeated string userinfo_signing_alg_values_supported = 44;
    bool require_pushed_authorization_requests = 45;
    repeated string claim_types_supported = 46;
    repeated string userinfo_encryption_alg_values_supported = 47;
    string end_session_endpoint = 48;
    string revocation_endpoint = 49;
    string backchannel_authentication_endpoint = 50;
    bool frontchannel_logout_supported = 51;
    repeated string token_endpoint_auth_signing_alg_values_supported = 52;
    string registration_endpoint = 53;
}

message AuthenticationRequest {
    string client_id = 1;
    string client_secret = 2;
    int64 tenant_id = 3;
    string username = 4;
    string password = 5;
}

message IsAuthenticatedResponse {
    bool authenticated = 1;
}

message GetUserManagementSATokenRequest {
    string client_id = 1;
    string client_secret = 2;
    int64 tenant_id = 3;
}

message GetAuthorizationEndpointRequest {
    int64 tenant_id = 1;
}

message AuthorizationResponse {
    string authorization_endpoint = 2;
}

message GetOIDCConfiguration {
    string client_id = 1;
    string client_secret = 2;
    int64 tenant_id = 3;
}

message GetJWKSRequest {
    string client_id = 1;
    string client_secret = 2;
    int64 tenant_id = 3;
}

message EndSessionRequest {
    string client_id = 1;
    string client_secret = 2;
    int64 tenant_id = 3;
    string refresh_token = 4;
}

message OperationStatus {
    bool status = 1;
}
