forked from eclipse-sw360/sw360
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sso-oauth): feedback from review
The commit fixes some issues and feedback from the review. However, a new property has been introduced to explicitly switch on/off the header authenticator. Signed-off-by: Leo von Klenze <[email protected]>
- Loading branch information
Showing
11 changed files
with
175 additions
and
93 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...thorization-server/src/main/java/org/eclipse/sw360/rest/authserver/StringTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Siemens AG, 2019. Part of the SW360 Portal Project. | ||
* | ||
* SPDX-License-Identifier: EPL-1.0 | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.eclipse.sw360.rest.authserver; | ||
|
||
public class StringTransformer { | ||
|
||
/** | ||
* Depending on the first parameter this method returns: | ||
* <ul> | ||
* <li>null: null</li> | ||
* <li>String[] with at least one element: first element</li> | ||
* <li>String[] with no element: ""</li> | ||
* <li>other: string value of parameter</li> | ||
* </ul> | ||
* | ||
* @param object object to transform into a single string | ||
* | ||
* @return the transformed string | ||
*/ | ||
public static String transformIntoString(Object object) { | ||
if(object == null) { | ||
return null; | ||
} | ||
|
||
if(object instanceof String[]) { | ||
if(((String[]) object).length > 0) { | ||
return ((String[])object)[0]; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
|
||
return object.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.