Skip to content

Commit d3974f1

Browse files
Create Client (#5)
* move client to internal Signed-off-by: Pascal Sochacki <[email protected]> * add empty client, create, observe and delete method Signed-off-by: Pascal Sochacki <[email protected]> * add secret to connection details Signed-off-by: Pascal Sochacki <[email protected]> * add more options to client Signed-off-by: Pascal Sochacki <[email protected]> * add admin url and weborigin * add options for Capability config * finish setting page on client Signed-off-by: Pascal Sochacki <[email protected]>
1 parent 735e78b commit d3974f1

18 files changed

+1433
-40
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ GO111MODULE = on
1919
-include build/makelib/golang.mk
2020

2121
# kind-related versions
22-
KIND_VERSION ?= v0.12.0
22+
KIND_VERSION ?= v0.16.0
2323
KIND_NODE_IMAGE_TAG ?= v1.23.4
2424

2525
# Setup Kubernetes tools

apis/v1alpha1/client_types.go

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
Copyright 2022 The Crossplane Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
"reflect"
21+
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
25+
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
26+
)
27+
28+
// ClientParameters are the configurable fields of a Client.
29+
// +kubebuilder:validation:XValidation:rule="!self.AuthorizationServicesEnabled || (self.AuthorizationServicesEnabled && self.ServiceAccountsEnabled)"
30+
type ClientParameters struct {
31+
Realm string `json:"Realm"`
32+
// +kubebuilder:validation:Enum=saml;openid-connect
33+
Protocol string `json:"Protocol"`
34+
// +optional
35+
Description *string `json:"Description"`
36+
// +optional
37+
Name *string `json:"Name"`
38+
// +optional
39+
// +kubebuilder:validation:Pattern=`^https?:\/\/.+$`
40+
RootUrl *string `json:"RootUrl"`
41+
// +optional
42+
// +kubebuilder:validation:Pattern=`^https?:\/\/.+$`
43+
HomeUrl *string `json:"HomeUrl"`
44+
// +optional
45+
ValidRedirectUris *[]string `json:"ValidRedirectUris"`
46+
// +optional
47+
ValidPostLogoutUris *[]string `json:"ValidPostLogoutUris"`
48+
// +optional
49+
AdminUrl *string `json:"AdminUrl"`
50+
// +optional
51+
WebOrigins *[]string `json:"WebOrigins"`
52+
// +optional
53+
PublicClient *bool `json:"PublicClient"`
54+
// +optional
55+
AuthorizationServicesEnabled *bool `json:"AuthorizationServicesEnabled"`
56+
// +optional
57+
ServiceAccountsEnabled *bool `json:"ServiceAccountsEnabled"`
58+
// +optional
59+
StandardFlowEnabled *bool `json:"StandardFlowEnabled"`
60+
// +optional
61+
DirectAccessGrantsEnabled *bool `json:"DirectAccessGrantsEnabled"`
62+
// +optional
63+
ImplicitFlowEnabled *bool `json:"ImplicitFlowEnabled"`
64+
// +optional
65+
Oauth2DeviceAuthorizationGrantEnabled *bool `json:"Oauth2DeviceAuthorizationGrantEnabled"`
66+
// +optional
67+
OidcCibaGrantEnabled *bool `json:"OidcCibaGrantEnabled"`
68+
// +optional
69+
LoginTheme *string `json:"LoginTheme"`
70+
// +optional
71+
ConsentRequired *bool `json:"ConsentRequired"`
72+
// +optional
73+
DisplayClientOnConsentScreen *bool `json:"DisplayClientOnConsentScreen"`
74+
// +optional
75+
MessageOnConsentScreen *string `json:"MessageOnConsentScreen"`
76+
// +optional
77+
FrontChannelLogout *bool `json:"FrontChannelLogout"`
78+
// +optional
79+
// +kubebuilder:validation:Pattern=`^https?:\/\/.+$`
80+
FrontChannelLogoutUrl *string `json:"FrontChannelLogoutUrl"`
81+
// +optional
82+
// +kubebuilder:validation:Pattern=`^https?:\/\/.+$`
83+
BackChannelLogoutUrl *string `json:"BackChannelLogoutUrl"`
84+
// +optional
85+
BackChannelLogoutSessionRequired *bool `json:"BackChannelLogoutSessionRequired"`
86+
// +optional
87+
BackchannelLogoutRevokeOfflineTokens *bool `json:"BackchannelLogoutRevokeOfflineTokens"`
88+
}
89+
90+
// ClientObservation are the observable fields of a Client.
91+
type ClientObservation struct {
92+
ObservableField string `json:"observableField,omitempty"`
93+
}
94+
95+
// A ClientSpec defines the desired state of a Client.
96+
type ClientSpec struct {
97+
xpv1.ResourceSpec `json:",inline"`
98+
ForProvider ClientParameters `json:"forProvider"`
99+
}
100+
101+
// A ClientStatus represents the observed state of a Client.
102+
type ClientStatus struct {
103+
xpv1.ResourceStatus `json:",inline"`
104+
AtProvider ClientObservation `json:"atProvider,omitempty"`
105+
}
106+
107+
// +kubebuilder:object:root=true
108+
109+
// A Client is an example API type.
110+
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
111+
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
112+
// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
113+
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
114+
// +kubebuilder:subresource:status
115+
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,keycloak}
116+
type Client struct {
117+
metav1.TypeMeta `json:",inline"`
118+
metav1.ObjectMeta `json:"metadata,omitempty"`
119+
120+
Spec ClientSpec `json:"spec"`
121+
Status ClientStatus `json:"status,omitempty"`
122+
}
123+
124+
// +kubebuilder:object:root=true
125+
126+
// ClientList contains a list of Client
127+
type ClientList struct {
128+
metav1.TypeMeta `json:",inline"`
129+
metav1.ListMeta `json:"metadata,omitempty"`
130+
Items []Client `json:"items"`
131+
}
132+
133+
// Client type metadata.
134+
var (
135+
ClientKind = reflect.TypeOf(Client{}).Name()
136+
ClientGroupKind = schema.GroupKind{Group: Group, Kind: ClientKind}.String()
137+
ClientKindAPIVersion = ClientKind + "." + SchemeGroupVersion.String()
138+
ClientGroupVersionKind = SchemeGroupVersion.WithKind(ClientKind)
139+
)
140+
141+
func init() {
142+
SchemeBuilder.Register(&Client{}, &ClientList{})
143+
}

apis/v1alpha1/realm_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type RealmParameters struct {
8080
// +kubebuilder:default=RS256
8181
DefaultSignatureAlgorithm *string `json:"defaultSignatureAlgorithm,omitempty"`
8282
// +optional
83-
// +kubebuilder:default=false
83+
// +kubebuilder:defaul`t=false
8484
RevokeRefreshToken *bool `json:"revokeRefreshToken,omitempty"`
8585
// +optional
8686
// +kubebuilder:default=0

0 commit comments

Comments
 (0)