File tree Expand file tree Collapse file tree
plugins/user-authenticators/oauth2/src/main/java/org/apache/cloudstack/oauth2/keycloak Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646import com .cloud .exception .CloudAuthenticationException ;
4747import com .cloud .utils .component .AdapterBase ;
4848import com .cloud .utils .exception .CloudRuntimeException ;
49+ import com .google .gson .JsonElement ;
4950import com .google .gson .JsonObject ;
5051import com .google .gson .JsonParser ;
5152
@@ -129,10 +130,14 @@ public String verifyCodeAndFetchEmail(String secretCode) {
129130 }
130131
131132 JsonObject json = JsonParser .parseString (body ).getAsJsonObject ();
132- String idToken = json .get ("id_token" ).getAsString ();
133- validateIdToken (idToken , provider );
133+ JsonElement fetchedIdToken = json .get ("id_token" );
134+ if (fetchedIdToken == null ) {
135+ throw new CloudRuntimeException ("No id_token found in token" );
136+ }
137+ String idTokenAsString = fetchedIdToken .getAsString ();
138+ validateIdToken (idTokenAsString , provider );
134139
135- this .idToken = idToken ;
140+ this .idToken = idTokenAsString ;
136141 } catch (IOException e ) {
137142 throw new CloudRuntimeException ("Unable to connect to Keycloak server" , e );
138143 }
Original file line number Diff line number Diff line change 186186 :href =" getGitHubUrl(from)"
187187 class =" auth-btn github-auth"
188188 style =" height : 38px ; width : 185px ; padding : 0 ; margin-bottom : 5px ;" >
189- <img src =" /assets/github.svg" alt =" Google " style =" width : 32px ; padding : 5px " />
189+ <img src =" /assets/github.svg" alt =" Github " style =" width : 32px ; padding : 5px " />
190190 <a-typography-text >Sign in with Github</a-typography-text >
191191 </a-button >
192192 </div >
198198 :href =" getGoogleUrl(from)"
199199 class =" auth-btn google-auth"
200200 style =" height : 38px ; width : 185px ; padding : 0 " >
201- <img src =" /assets/google.svg" alt =" Github " style =" width : 32px ; padding : 5px " />
201+ <img src =" /assets/google.svg" alt =" Google " style =" width : 32px ; padding : 5px " />
202202 <a-typography-text >Sign in with Google</a-typography-text >
203203 </a-button >
204204 </div >
You can’t perform that action at this time.
0 commit comments