@@ -936,107 +936,3 @@ describe('ACL with WebID+TLS', function () {
936936 } )
937937 } )
938938} )
939-
940- describe ( 'ACL with WebID through X-SSL-Cert' , function ( ) {
941- let hasX509
942- try {
943- require ( 'x509' )
944- hasX509 = true
945- } catch ( error ) {
946- hasX509 = false
947- }
948-
949- var ldpHttpsServer
950- before ( function ( done ) {
951- const ldp = ldnode . createServer ( {
952- mount : '/test' ,
953- root : rootPath ,
954- webid : true ,
955- auth : 'tls' ,
956- certificateHeader : 'X-SSL-Cert'
957- } )
958- ldpHttpsServer = ldp . listen ( 3456 , done )
959- } )
960-
961- after ( function ( ) {
962- if ( ldpHttpsServer ) ldpHttpsServer . close ( )
963- fs . removeSync ( path . join ( rootPath , 'index.html' ) )
964- fs . removeSync ( path . join ( rootPath , 'index.html.acl' ) )
965- } )
966-
967- function prepareRequest ( certHeader , setResponse ) {
968- return done => {
969- const options = {
970- url : address . replace ( 'https' , 'http' ) + '/acl-tls/write-acl/.acl' ,
971- headers : { 'X-SSL-Cert' : certHeader }
972- }
973- request ( options , function ( error , response ) {
974- setResponse ( response )
975- done ( error )
976- } )
977- }
978- }
979-
980- describe ( 'without certificate' , function ( ) {
981- var response
982- before ( prepareRequest ( '' , res => { response = res } ) )
983-
984- it ( 'should return 401' , function ( ) {
985- assert . propertyVal ( response , 'statusCode' , 401 )
986- } )
987- } )
988-
989- describe ( 'with a valid certificate' , function ( ) {
990- // Escape certificate for usage in HTTP header
991- const escapedCert = userCredentials . user1 . cert . toString ( )
992- . replace ( / \n / g, '\t' )
993-
994- var response
995- before ( prepareRequest ( escapedCert , res => { response = res } ) )
996-
997- it ( 'should return 200' , function ( ) {
998- hasX509 || this . skip ( )
999- assert . propertyVal ( response , 'statusCode' , 200 )
1000- } )
1001-
1002- it ( 'should set the User header' , function ( ) {
1003- hasX509 || this . skip ( )
1004- assert . propertyVal ( response . headers , 'user' , 'https://user1.databox.me/profile/card#me' )
1005- } )
1006- } )
1007-
1008- describe ( 'with a local filename as certificate' , function ( ) {
1009- const certFile = path . join ( __dirname , '../keys/user1-cert.pem' )
1010-
1011- var response
1012- before ( prepareRequest ( certFile , res => { response = res } ) )
1013-
1014- it ( 'should return 401' , function ( ) {
1015- assert . propertyVal ( response , 'statusCode' , 401 )
1016- } )
1017- } )
1018-
1019- describe ( 'with an invalid certificate value' , function ( ) {
1020- var response
1021- before ( prepareRequest ( 'xyz' , res => { response = res } ) )
1022-
1023- it ( 'should return 401' , function ( ) {
1024- assert . propertyVal ( response , 'statusCode' , 401 )
1025- } )
1026- } )
1027-
1028- describe ( 'with an invalid certificate' , function ( ) {
1029- const invalidCert =
1030- `-----BEGIN CERTIFICATE-----
1031- ABCDEF
1032- -----END CERTIFICATE-----`
1033- . replace ( / \n / g, '\t' )
1034-
1035- var response
1036- before ( prepareRequest ( invalidCert , res => { response = res } ) )
1037-
1038- it ( 'should return 401' , function ( ) {
1039- assert . propertyVal ( response , 'statusCode' , 401 )
1040- } )
1041- } )
1042- } )
0 commit comments