FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SecurityShepherd/src/main/java/utils/LoginMethod.java at dev · OWASP/SecurityShepherd · GitHub
OWASP
/
SecurityShepherd
Public
Notifications
You must be signed in to change notification settings
Fork
515
Star
1.5k
Code
Issues
137
Pull requests
21
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
SecurityShepherd
/
src
/
main
/
java
/
utils
/
LoginMethod.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
79 lines (61 loc) · 2.33 KB
Breadcrumbs
SecurityShepherd
/
src
/
main
/
java
/
utils
/
LoginMethod.java
Copy path
File metadata and controls
79 lines (61 loc) · 2.33 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package
utils
;
import
java
.
io
.
IOException
;
import
java
.
io
.
InputStream
;
import
java
.
util
.
Properties
;
import
org
.
apache
.
logging
.
log4j
.
LogManager
;
import
org
.
apache
.
logging
.
log4j
.
Logger
;
/**
* Loads the SSO login configuration, if any. <br>
* This file is part of the Security Shepherd Project.
*
* <p>The Security Shepherd project is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.<br>
*
* <p>The Security Shepherd project is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.<br>
*
* <p>You should have received a copy of the GNU General Public License along with the Security
* Shepherd project. If not, see <http://www.gnu.org/licenses/>.
*
* @author Mark Denihan
*/
public
class
LoginMethod
{
private
static
boolean
isSaml
=
false
;
private
static
boolean
isSet
=
false
;
private
static
final
Logger
log
=
LogManager
.
getLogger
(
LoginMethod
.
class
);
public
static
boolean
isSaml
() {
if
(
isSet
) {
// Data is cached, so let's fetch it from cache
return
isSaml
;
}
else
{
ClassLoader
classLoader
=
LoginMethod
.
class
.
getClassLoader
();
String
unpackFileName
=
"sso.properties"
;
try
(
InputStream
inputStream
=
classLoader
.
getResourceAsStream
(
unpackFileName
)) {
if
(
inputStream
!=
null
) {
Properties
prop
=
new
Properties
();
prop
.
load
(
inputStream
);
if
(
prop
!=
null
) {
// Get id and name from SAML data
String
isSSOEnabled
=
prop
.
getProperty
(
"sso.enabled"
);
isSaml
=
Boolean
.
parseBoolean
(
isSSOEnabled
);
isSet
=
true
;
}
}
else
{
// SSO properties found, we default to sso = false
isSaml
=
false
;
isSet
=
true
;
}
}
catch
(
IOException
e
) {
String
errorMsg
=
"SAML unpack properties file '"
+
unpackFileName
+
"' cannot be loaded"
;
log
.
error
(
errorMsg
);
throw
new
RuntimeException
(
errorMsg
);
}
return
isSaml
;
}
}
public
static
Boolean
isLogin
() {
return
(!
isSaml
());
}
}
Back
|
FazBrowse Home
|
New Git URL