Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
14962573
Commit
14962573
authored
Aug 21, 2017
by
ashutoshm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2038: Minor refactoring to use org.apache.commons.codec.binary.Base64.
parent
2841b85e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
AtlasAuthenticationSimpleFilterIT.java
.../atlas/web/filters/AtlasAuthenticationSimpleFilterIT.java
+5
-6
No files found.
webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationSimpleFilterIT.java
View file @
14962573
...
...
@@ -19,7 +19,7 @@ package org.apache.atlas.web.filters;
import
org.apache.atlas.web.security.BaseSecurityTest
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
sun.misc.BASE64Encoder
;
import
org.apache.commons.codec.binary.Base64
;
import
javax.ws.rs.core.Response
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
...
...
@@ -30,8 +30,7 @@ import static org.testng.Assert.assertEquals;
*
*/
public
class
AtlasAuthenticationSimpleFilterIT
extends
BaseSecurityTest
{
private
BASE64Encoder
enc
=
new
sun
.
misc
.
BASE64Encoder
();
private
Base64
enc
=
new
Base64
();
@Test
(
enabled
=
true
)
public
void
testSimpleLoginForValidUser
()
throws
Exception
{
...
...
@@ -39,7 +38,7 @@ public class AtlasAuthenticationSimpleFilterIT extends BaseSecurityTest {
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
String
userpassword
=
"admin:admin"
;
// right password
String
encodedAuthorization
=
enc
.
encode
(
userpassword
.
getBytes
());
String
encodedAuthorization
=
enc
.
encode
ToString
(
userpassword
.
getBytes
());
connection
.
setRequestProperty
(
"Authorization"
,
"Basic "
+
encodedAuthorization
);
connection
.
connect
();
...
...
@@ -68,7 +67,7 @@ public class AtlasAuthenticationSimpleFilterIT extends BaseSecurityTest {
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
String
userpassword
=
"rangertagsync:rangertagsync"
;
//right password with no policy for taxonomies api
String
encodedAuthorization
=
enc
.
encode
(
userpassword
.
getBytes
());
String
encodedAuthorization
=
enc
.
encode
ToString
(
userpassword
.
getBytes
());
connection
.
setRequestProperty
(
"Authorization"
,
"Basic "
+
encodedAuthorization
);
connection
.
connect
();
...
...
@@ -87,7 +86,7 @@ public class AtlasAuthenticationSimpleFilterIT extends BaseSecurityTest {
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
String
userpassword
=
"admin:admin1"
;
//wrong password
String
encodedAuthorization
=
enc
.
encode
(
userpassword
.
getBytes
());
String
encodedAuthorization
=
enc
.
encode
ToString
(
userpassword
.
getBytes
());
connection
.
setRequestProperty
(
"Authorization"
,
"Basic "
+
encodedAuthorization
);
connection
.
connect
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment